[Dojo-interest] Intermittent ScrollBox Issue

Jared Jurkiewicz jared.jurkiewicz at gmail.com
Tue Apr 28 14:31:09 EDT 2009


The only thing I can think of is that _onFetchComplete will fire more
than once.  Every time the grid loads a new page of data in, that'll
fire, and as such call your init scrollboxes function.   This may or
may not be a big deal to you.  If you want to just fire it once, you
can do something like:

var tgCon = null;

// Connect to the total grid fetch complete to init the scrollboxes:
tgCon = dojo.connect(gridTotal, "_onFetchComplete",
 function() {
   dojo.disconnect(tgCon);
   initScrollBoxes();
 }
);


var mainGridCon = null;
// Connect to the main grid fetch complete to startup the total grid:
mainGridCon = dojo.connect(grid, "_onFetchComplete",
 function() {
   dojo.disconnect(mainGridCon);
   gridTotal.startup();
 }
);


And that will disconnect the listeners on the first call to them.


On Tue, Apr 28, 2009 at 10:55 AM, Devine, James <james.devine at fmr.com> wrote:
> Thanks so much for the help.  Since I have 2 grids (and both must be
> populated), I have implemented it as detailed below.
>
> Please let me know if you see any issues.  So far, it seems to be
> working.
>
> // Sequence of events:
> // 1) Startup main grid
> // 2) Startup total grid (after main grid fetch complete)
> // 3) Init scrollboxes (after total grid fetch complete)
>
> // Connect to the total grid fetch complete to init the scrollboxes:
> dojo.connect(gridTotal, "_onFetchComplete",
>  function() {
>    initScrollBoxes();
>  }
> );
>
> // Connect to the main grid fetch complete to startup the total grid:
> dojo.connect(grid, "_onFetchComplete",
>  function() {
>    gridTotal.startup();
>  }
> );
>
> // Startup the main grid:
> grid.startup();
>
>
> -----Original Message-----
> From: dojo-interest-bounces at mail.dojotoolkit.org
> [mailto:dojo-interest-bounces at mail.dojotoolkit.org] On Behalf Of Jared
> Jurkiewicz
> Sent: Tuesday, April 28, 2009 10:17 AM
> To: dojo-interest at mail.dojotoolkit.org
> Subject: Re: [Dojo-interest] Intermittent ScrollBox Issue
>
> The function is an internal one:
>
>     _onFetchComplete
>
> It's what the grid passes to the store to indicate data has returned.
>  Connecting to it should signal when the grid has populated its table
> structures.
>
> -- Jared
>
>
>
> On Tue, Apr 28, 2009 at 10:12 AM, Devine, James <james.devine at fmr.com>
> wrote:
>> Thank you for your help.  I've updated my code to use dojo.style.
>>
>> Could you please point me to more information on the grid's onComplete
>> style functions?
>>
>> I am new to Dojo and am not familiar with these.  The only onComplete
>> functions that I have been able to find pertain to the datastore.
>>
>> Thank you.
>>
>> -----Original Message-----
>> From: dojo-interest-bounces at mail.dojotoolkit.org
>> [mailto:dojo-interest-bounces at mail.dojotoolkit.org] On Behalf Of Jared
>> Jurkiewicz
>> Sent: Tuesday, April 28, 2009 9:35 AM
>> To: dojo-interest at mail.dojotoolkit.org
>> Subject: Re: [Dojo-interest] Intermittent ScrollBox Issue
>>
>> I recommend using dojo.style() to modify style properties over direct
>> access.   Eg:
>>
>> dojo.style(scrollBoxes[0], "overflowY", "hidden");
>>
>> For generally more consistent behavior.
>>
>> Also, since grid loads async, I would not be surprised if its simply
>> timing on when grid has constructed the scroll box.  You may want to
>> connect to the grid's onComplete style functions and listen to when
>> they get called before you attempt to access scroll boxes.
>>
>> -- Jared
>>
>>
>>
>> On Tue, Apr 28, 2009 at 8:22 AM, Devine, James <james.devine at fmr.com>
>> wrote:
>>> Hello,
>>> I am seeing an intermittent timing issue with DataGrid scrollboxes (I
>> am
>>> using Dojo 1.3).
>>>
>>> - The last 2 lines of my addOnLoad method look like this:
>>> initScrollBoxes();
>>> dojo.style(dojo.body(), "visibility", "visible");
>>>
>>> - initScrollBoxes configures scrollboxes for 2 stacked grids:
>>> function initScrollBoxes() {
>>>
>>>  scrollBoxes = [];
>>>
>>>  // Get an array of the main grid and total grid scrollboxes:
>>>  dojo.query(".dojoxGridScrollbox", this.domNode).forEach(
>>>    function(x) {
>>>      scrollBoxes.push(x);
>>>    }
>>>  );
>>>
>>>  // Connect the onscroll of the total grid to the scroll of the main
>>> grid:
>>>  dojo.connect(scrollBoxes[1], "onscroll", function() {
>>>    scrollBoxes[0].scrollLeft = scrollBoxes[1].scrollLeft;}
>>>  );
>>>
>>>  // Hide the main grid horizontal scroll bar:
>>>  scrollBoxes[0].style.overflowX="hidden";
>>>
>>>  // If the top table is vertical scrolling, hide the total grid
>>> vertical srollbar, but
>>>  // create a 16px border to take up the width of the top scrollbar:
>>>  if (!useAutoHeight()) {
>>>     scrollBoxes[1].style.overflowY="hidden";
>>>     scrollBoxes[1].style.borderRight="solid";
>>>     scrollBoxes[1].style.borderWidth="16px";
>>>     scrollBoxes[1].style.borderColor="#ededed";
>>>  }
>>> }
>>>
>>> About 10% of the time that the page loads, I get an error saying
> that:
>>> 'scrollBoxes.0.style' is null or not an object
>>>
>>> Please let me know what I am doing wrong or if there is a recommended
>>> way to solve this problem.
>>>
>>> Thanks in advance.
>>>
>>>
>>> _______________________________________________
>>> FAQ: http://dojotoolkit.org/support/faq
>>> Book: http://dojotoolkit.org/docs/book
>>> Forums: http://dojotoolkit.org/forum
>>> Dojo-interest at mail.dojotoolkit.org
>>> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>>>
>> _______________________________________________
>> FAQ: http://dojotoolkit.org/support/faq
>> Book: http://dojotoolkit.org/docs/book
>> Forums: http://dojotoolkit.org/forum
>> Dojo-interest at mail.dojotoolkit.org
>> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>>
>>
>> _______________________________________________
>> FAQ: http://dojotoolkit.org/support/faq
>> Book: http://dojotoolkit.org/docs/book
>> Forums: http://dojotoolkit.org/forum
>> Dojo-interest at mail.dojotoolkit.org
>> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>>
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://dojotoolkit.org/docs/book
> Forums: http://dojotoolkit.org/forum
> Dojo-interest at mail.dojotoolkit.org
> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>
>
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://dojotoolkit.org/docs/book
> Forums: http://dojotoolkit.org/forum
> Dojo-interest at mail.dojotoolkit.org
> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>


More information about the Dojo-interest mailing list