Announcement

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

    addDataArrivedHandler setData issue

    Nothing is fired. is normal this behavior
    Code:
    GridSource.fetchData(new.....................ute(DSResponse response,
    Object rawData, DSRequest request) {
    
    Grid_editor.setData(response.getData());
    loading = 0;						
    
    }});
    
    
    Grid_editor.addDataArrivedHandler(new DataArrivedHandler()
    {
    	public void onDataArrived(DataArrivedEvent event)
    	{
    		SC.say("test");
    	}
    });

    [docs]
    Add a dataArrived handler.
    Notification method fired when new data arrives from the server to be displayed in this ListGrid, (for example in response to the user scrolling a new set of rows into view). Only applies to databound listGrids where the data attribute is a com.smartgwt.client.data.ResultSet. This ResultSet may have been created manually and applied to the grid via a call to ListGrid.setData or may have been created and automatically assigned if ListGrid.fetchData was used to populate the grid. This method is fired directly in response to dataArrived() firing on the data object.

    #2
    i think this is a bug

    Comment


      #3
      Hello,

      same question. Isn't the DataArrivedHandler to be fired when calling grid.setData manually?
      If not because of not working via DataSources here, is there some other way to get a notice whenever data is put in a grid?



      Notification method fired when new data arrives from the server to be displayed in this ListGrid,
      (for example in response to the user scrolling a new set of rows into view).
      Only applies to databound listGrids where the data attribute is a com.smartgwt.client.data.ResultSet.
      This ResultSet may have been created manually and applied to the grid via a call to ListGrid.setData
      or may have been created and automatically assigned if ListGrid.fetchData was used to populate the grid. This method is fired directly in response to dataArrived() firing on the data object.

      problem & repro: it seems DataArrivedEvent isn't fired because I never see the SC.say() popup.
      Code:
      private void test10() {		
      	final ListGrid grid = new ListGrid();
      	ListGridField field1 = new ListGridField("a");
      	ListGridField field2 = new ListGridField("b");
      	grid.setFields(field1, field2);
      	final ListGridRecord record1 = new ListGridRecord();
      	record1.setAttribute("a", "this is a");
      	record1.setAttribute("b", "this is b");
      	final ListGridRecord record2 = new ListGridRecord();
      	record2.setAttribute("a", "this is something");
      	record2.setAttribute("b", "this is also something");
      	
      	grid.addDataArrivedHandler(new DataArrivedHandler() {
      		
      		public void onDataArrived(DataArrivedEvent event) {
      			//This is never called :(
      			SC.say("Yes, data arrived: "+ event.getEndRow());
      		}
      	});
      	
      	Button addData = new Button("Add data to grid");
      	addData.addClickHandler(new ClickHandler() {
      		
      		public void onClick(ClickEvent event) {
      			grid.setData(new ListGridRecord[]{record1, record2});
      		}
      	});
      	
      	VLayout layout = new VLayout();
      	layout.setMembers(grid, addData);
      	layout.draw();
      }
      GWT 2.1.0 WinXP IE8 devmode
      SmartGWT EE build 14/12/2010

      Comment


        #4
        By design, events in general do not fire for programmatic actions like setData() or setValue(), since this makes people much more likely to write infinite loops. If you need to take the same action for setData() as for DataArrived, call the same logic yourself.

        Comment


          #5
          how to use setDataArrivedHandler with ListGrid when using setData().Can you please give brief idea about how to apply the logic ?

          Comment

          Working...
          X