Author Topic: Row selection  (Read 3028 times)

lgauton

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 44
    • View Profile
Row selection
« on: May 14, 2014, 02:03:09 pm »
Hi Hope you can help with this problem. I have GridA that populates GridB using a rowselect function, then GridB populates a form again based on a rowselect function. First time round all works correctly, but on second rowselect of GridB the function fires twice once based on the row data from the first selection (checked by capturing the value held in ui.rowData[0]) and then for the correct value (again checking value ui.rowData[0]), this continues for third (this times fires 3 times), fourth (this time fires four times) etc.

Closing browser and starting again just repeats above process

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Row selection
« Reply #1 on: May 14, 2014, 02:31:34 pm »
lgauton

It looks like you are binding to rowSelect event multiple times.

If you are not able to resolve it, please post a small but complete test case so that we can test it on our end.

lgauton

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: Row selection
« Reply #2 on: May 14, 2014, 03:09:14 pm »
Thanks

I do 'destroy' GridB each time it is populated from a GridA selection, my assumption here is that 'destroy' does just that so I cannot see that I would be binding to rowSelect event multiple times

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Row selection
« Reply #3 on: May 14, 2014, 11:51:25 pm »
Any events bound to the element using below format are not removed by destroy.

Code: [Select]
$( '.selector' ).on( 'pqgridrowselect', function (evt, ui ){ } );
//or
$( '.selector' ).bind( 'pqgridrowselect', function (evt, ui ){ } );

Either change the binding into an option callback format or don't use destroy.