Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    ListGrid manually adding data

    Hi,

    I'm trying to manually add data to a ListGrid with SmartGWT 2.4, and after I load the data the whole client becomes incredibly slow and unresponsive.

    What I'm doing is using a GWTRpc service to get back a list of records called HeardReport. Then:

    Code:
    @Override
    public void onSuccess(List<MyObj> reports) {
    	int numRows = reports.size();
    
    	for(int i=0; i<numRows; ++i) {
    		Record r = new Record();
    		MyObj report = reports.get(i);
    
    		/* copy all fields */
    		r.setAttribute("platformId", report.getPlatformId());
    		...
    
    		grid.addData(r);
    	}
    I tried building a RecordList and calling grid.setData() but that didn't help. The documentation there confused me:

    Code:
    setData
    public void setData(ListGridRecord[] records)
      A List of ListGridRecord objects, specifying the data to be used to populate the
      ListGrid. In ListGrids, the data array specifies rows. Note that ListGrids automatically
      observe changes to the data List and redraw accordingly.
    
      This property is settable directly only as part of a ListGrid constructor. If you want
      to change the ListGrid's data after initial creation, call 
      setData(com.smartgwt.client.widgets.grid.ListGridRecord[]).
    1) there is no such constructor ListGrid(ListGridRecord[]) ... perhaps they mean this is what happens INTERNALLY?

    2) It's telling me to call setData(ListGridRecord[]) which appears to be directing me to the same thing I'm already reading? See http://www.smartclient.com/smartgwt/...dRecord&#91;]) to see what I mean.

    When it becomes unresponsive, so does the debugger and SpeedTracer. The only slight clue I have as to where it's stuck is when I use Firefox, and it tells me: "A script on this page may be busy, or it may have stopped responding. Script: http://localhost:8080/hello/sc/modules?ISC_Grids.js:60"

    #2
    Could it be beacuse I was using Record rather than ListGridRecord? When I switched to ListGridRecord the performance now seems OK.

    Comment

    Working...
    X