Author Topic: pqgridload is not working in firefox and safari  (Read 2680 times)

bsolteam

  • Pro Deluxe
  • Full Member
  • *
  • Posts: 107
    • View Profile
pqgridload is not working in firefox and safari
« on: September 15, 2014, 08:07:54 pm »
Hi,
In my screen 8 grids are there. In that three grids are getting values from db. Other grids are getting calculated values from these 3 grids. So after these 3 grids data's are loaded then I need to call the external function for calculation. For this I have used the following code.
Code: [Select]
$( "#vessel_tab_main" ).on( "pqgridload", function( event, ui ) {
        $( "#VoyageDetails_tab_main" ).on( "pqgridload", function( event, ui ) {
        $( "#poolrules_tab_main" ).on( "pqgridload", function( event, ui ) {
        var vessel=-1;
        var voyage=-1;
var poolrule=-1;
        refresh: update ( event, ui,vessel,voyage,poolrule );
        } );
        } );
        } );
The above code will run only in chrome and ie. It is not working in firefox and safari.
if am using the following code it will run in all the browser. Also some time it is not running, it get struck.
Code: [Select]
$( "#vessel_tab_main" ).on( "pqgridload", function( event, ui ) {
        $( "#VoyageDetails_tab_main" ).on( "pqgridload", function( event, ui ) {
        var vessel=-1;
        var voyage=-1;
var poolrule=-1;
        refresh: update ( event, ui,vessel,voyage,poolrule );
        } );
        } );

Why it is happening. Anything wrong. Please help me to overcome this.

Thanks in advance.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: pqgridload is not working in firefox and safari
« Reply #1 on: September 16, 2014, 11:08:34 am »
Nesting the load event listeners within one another is flawed for 2 main reasons:

1) It would accumulate undesirable multiple event listeners over time which would lead to serious performance issues.

2) The order of the load event listeners can't be assumed and it may vary across different browsers.

So remove the nesting, bind the load event listeners independently, keep a flag or a counter which increments as the different grids load, call your custom function when counter reaches 3 and reset the counter for next cycle.

bsolteam

  • Pro Deluxe
  • Full Member
  • *
  • Posts: 107
    • View Profile
Re: pqgridload is not working in firefox and safari
« Reply #2 on: September 16, 2014, 03:24:29 pm »
Thanks for your support. Its worked.