Tutorial :flex datagrid freezes while retrieving data



Question:

i have a datagrid which grows in size depending on the result of a call to my db. The call to the database returns an object with 30+ values for each row. When the number of rows returned exceeds about 80-90 the datagrid renders odd. It displays the first 50-60 rows fine but then it displays blank rows and they even continue to display outside the border of the datagrid.

anyone any ideas what is happening? Im using mxml webservice to retrieve the data.

<mx:DataGrid dataProvider="{resultsData}" rowCount="{resultsData.length}" allowDragSelection="false"       id = "confRoomLookupResults" width="948"       variableRowHeight="true" draggableColumns="false" wordWrap="true" resizableColumns="false"        borderColor="#E0E3E5" borderStyle="inset" x="10" top="35"  


Solution:1

There is a 2880px limit for a dimension of a flash movie (http://kb2.adobe.com/cps/144/tn_14437.html). Perhaps your data grid is exceeding these limits and it's causing the rendering error. Are there any exceptions being thrown?

In any case, I'd go with JustFoo's suggestion and just use the scroll bar. It makes sense since flash will only have to render what's visible, which will be a big performance increase for the client.


Solution:2

Is there a specific reason why you want the row count set as the length of the data returned?

What if you just try setting the height of the datagrid to 100%, this will fill up the viewable area with the datagrid and any overflow of rows will cause a vertical scroll bar to appear.

Hope this helps.


Solution:3

Sounds like there are two problems:

1) the rowCount is beyond the display are of the viewable area of the datagrid.

2) It seems that you are using a Array not a custom object so the changes to the Array, such as length will not be evident...

From the Adobe site: http://livedocs.adobe.com/flex/3/html/help.html?content=about_dataproviders_2.html

If you use a raw data object, such as an Array, as a control's data provider, Flex automatically wraps the object in a collection wrapper. The control does not automatically detect changes that are made directly to the raw object. A change in the length of an array, for example, does not result in an update of the control. You can, however, use an object proxy, a listener interface, or the itemUpdated property to notify the view of certain changes.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »