Author Topic: pqgridload not getting called after upgrade to 3.2  (Read 3000 times)

JUNZHONG

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 16
    • View Profile
pqgridload not getting called after upgrade to 3.2
« on: December 15, 2015, 02:10:04 am »
Below is the piece of code which we used to repopulate the filter which user has applied earlier. This is not getting called. Can you please let us know the changes.

//for showing saved filters
            $grid.one("pqgridload", function (evt, ui) {
               if (typeof filterObject !== 'undefined' && filterObject.length > 0) {
                  $("#grid_procedure").pqGrid( "filter", {
                        oper: 'add',
                        data: filterObject
                       
                        
                    });
                  var grid = $grid.pqGrid("getInstance").grid;
                  grid.refreshView();
               }
            });

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: pqgridload not getting called after upgrade to 3.2
« Reply #1 on: December 15, 2015, 04:49:25 pm »
This is a DOM based event listener.

These are changes:

1) Type of event is "pqGrid:load" instead of "pqgridload"

2) option trigger should be true i.e.,  trigger: true

Ref: http://paramquery.com/pro/upgrade#option-general

JUNZHONG

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: pqgridload not getting called after upgrade to 3.2
« Reply #2 on: December 15, 2015, 10:08:15 pm »
ok I changed accordingly
$("#grid_procedure").on("pqGrid:load", function (evt, ui) {
               if (typeof filterObject !== 'undefined' && filterObject.length > 0) {
                  $("#grid_procedure").pqGrid( "filter", {
                        oper: 'add',
                        data: filterObject
                    });
                  var grid = $grid.pqGrid("getInstance").grid;
                  grid.refreshView();
               }
            });

Here
$("#grid_procedure").pqGrid( "filter" -> is getting called recursively. Now can I not use the filter in the load method for the same grid?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: pqgridload not getting called after upgrade to 3.2
« Reply #3 on: December 15, 2015, 10:10:19 pm »
It's because you changed one() to on()

JUNZHONG

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: pqgridload not getting called after upgrade to 3.2
« Reply #4 on: December 15, 2015, 10:20:41 pm »
Great help buddy. That worked. Thank you so much!!!