Author Topic: Need "Complete" Event  (Read 4374 times)

rsordillo

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 6
    • View Profile
Need "Complete" Event
« on: November 08, 2015, 09:54:07 am »
Greetings,

When you were helping me with the evaluation, we had discussed adding a "complete" event that fires when every process in creating and loading a grid is finished and nothing else occurs after that. We really need something like that.

Regards,
Steve

rsordillo

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Need "Complete" Event
« Reply #1 on: November 12, 2015, 07:54:35 am »
We are becoming more in need of an event that fires after EVERYTHING is completed....particularly large data loads and the resultant render of the grid. In fact, we are getting desperate for this as I am writing some hacks to tweak the grid to behave as we need it to behave with regards to width and height constraints. We are getting short on time waiting for additional implementation of the things we are needing, so it is imperative that I get some things working.

I simply cannot make some things work until I can create a listener on an event that fires once the grid is fully loaded and rendered with no other action taking place. The hacks I have written work until there is somewhat of a delay in getting the remote data back from the server at which point the code doesn't work because the grid apparently is overriding grid options that I am trying to set after the fact.

For instance, I initialize the grid with "width:'flex'" which of course forces the grid to expand to accommodate all columns with no scrolling. I do this for smaller grids so that there is no large gap between the last column and the edge of the grid. I then wait for several "refresh" events to fire and fire off my hack that resets the grid width to "auto" so that the scrolling is enabled if a user resizes the browser. Like I said, with large and delayed remote data calls, there is a delay and something happens that resets the width back to "flex" and ignores my code.

Regards,
Steve 

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Need "Complete" Event
« Reply #2 on: November 12, 2015, 08:02:27 am »
Steve

setTimeout is the easiest way to ensure that everything is complete.

if remote data, then put setTimeout in the load event.

if local data, then put setTimeout in the create event.

Code: [Select]
    create: function(){
        out("create");
        if(this.option('dataModel.location') == 'remote'){
            this.one('load', function(){
                setTimeout(function(){
                    out("complete");
                },0);                           
            });
        }
        else{
            setTimeout(function(){         
                out("complete");
            },0);           
        }       
    },

http://jsfiddle.net/6gxjb0hv/10/

Hope it helps.

Regards
« Last Edit: November 12, 2015, 08:30:09 am by paramquery »

rsordillo

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Need "Complete" Event
« Reply #3 on: November 20, 2015, 03:44:08 am »
This did indeed help. So far, everything I am invoking in the grid results in that always being the last event.

Thank you!!!  :D  :D

-Steve