Author Topic: After Upgrade to 3.2.0 history changes no longer works  (Read 2770 times)

gammax500

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 16
    • View Profile
After Upgrade to 3.2.0 history changes no longer works
« on: November 19, 2015, 07:46:31 pm »
I just upgraded to v 3.2.0 in order to use new checkbox attributes, however now my grid has broken.  When changes are made to data, save buttons no longer enable.

This code enables/disables header row buttons to submit or rollback changes:

history: function (evt, ui) {
                var $grid = $(this);
                if (ui.canUndo != null) {
                    $("button.changes", $grid).button("option", { disabled: !ui.canUndo });
                }
                if (ui.canRedo != null) {
                    $("button:contains('Redo')", $grid).button("option", "disabled", !ui.canRedo);
                }
                $("button:contains('Undo')", $grid).button("option", { label: 'Undo (' + ui.num_undo + ')' });
                $("button:contains('Redo')", $grid).button("option", { label: 'Redo (' + ui.num_redo + ')' });
            },


paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: After Upgrade to 3.2.0 history changes no longer works
« Reply #1 on: November 19, 2015, 09:44:04 pm »
It is due to change in context of callbacks and events.

http://paramquery.com/pro/upgrade/index

1. Context of general and event based callbacks has been changed from DOM reference to widget instance.

So the below

Code: [Select]
var $grid = $(this);

can be replaced with

Code: [Select]
var $grid = this.widget();

Example: http://paramquery.com/pro/demos/editing_batch

gammax500

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: After Upgrade to 3.2.0 history changes no longer works
« Reply #2 on: November 19, 2015, 10:23:58 pm »
Thank you!  That did the trick.