Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline edit Uncaught TypeError: $.nette.ajax(...).success is not a function #340

Closed
bazo opened this Issue Aug 25, 2016 · 1 comment

Comments

2 participants
@bazo
Copy link

bazo commented Aug 25, 2016

When using inline edit and clicking outside the editable area this error gets raised in datagrid.js:471

the $.nette.ajax call result is not the nette.ajax object, but xhr object which is a promise
it can be fixed like this

submit = function(cell, el) {
      value = el.val();
      if (value !== cell.data('value')) {
        var res = $.nette.ajax({
          url: cell.data('datagrid-editable-url'),
          data: {
            value: value
          },
          method: 'POST',
          success: function() {
          return cell.addClass('edited');
        }
        });
      }
      cell.removeClass('editing');
      return cell.html(value);
    };

or

submit = function(cell, el) {
      value = el.val();
      if (value !== cell.data('value')) {
        $.nette.ajax({
          url: cell.data('datagrid-editable-url'),
          data: {
            value: value
          },
          method: 'POST'
        }).done(function() {
          return cell.addClass('edited');
        });
      }
      cell.removeClass('editing');
      return cell.html(value);
    };
@paveljanda

This comment has been minimized.

Copy link
Member

paveljanda commented Sep 7, 2016

Can you please send a PR to datagrid.coffee? Thanks a lot!

@paveljanda paveljanda added this to the v5.0 milestone Nov 15, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.