Announcement

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

    ReOrder ListGrid with DataSource

    Hy, in a ListGrid, on onRecordDrop() i try to :
    * update all records on ListGrid
    * fetch ListGrid

    It's working, but after the final fecth, if i will use again my grid records, i catch this error :

    Uncaught JavaScript exception [com.google.gwt.dev.shell.HostedModeException: Expected primitive type int; actual value was undefined
    On line : for( ListGridRecord lgr : countryGrid.getRecords() ) {
    At method : countryGrid.getRecords()

    Trace :
    ** First Pass ReOrder by Drag Drop ** :
    RecordDropHandler event : An event type
    countryGrid != NULL
    countryGridgetRecords() != NULL
    ** Second Pass ReOrder by Drag Drop ** :
    RecordDropHandler event : An event type
    countryGrid != NULL
    Uncaught JavaScript exception [com.google.gwt.dev.shell.HostedModeException: Expected primitive type int; actual value was undefined
    Code:
    	final ListGrid countryGrid = new ListGrid();  
    
            countryGrid.setDataSource(countryDS); 
            countryGrid.setAutoFetchData(true); 
    
            ....
    
            countryGrid.addRecordDropHandler(new RecordDropHandler() {
    
    			@Override
    			public void onRecordDrop(RecordDropEvent event) {
    
    				System.out.println("RecordDropHandler event : " + event);
    				
    				if( countryGrid != null )
    					System.out.println("countryGrid != NULL");
    				if( countryGrid.getRecords() != null )
    					System.out.println("countryGridgetRecords() != NULL");
    				
    				for( ListGridRecord lgr : countryGrid.getRecords() ) {
    					// ReOrder by setAttribute
    //					lgr.setAttribute("orderId", newOrder);
    					
    					countryGrid.updateData(lgr);
    				}
    				
    				countryGrid.invalidateCache();
    				countryGrid.fetchData();
    				
    			}
            	
            });
    The last fetch should not refresh ListGrid cache ?

    If i comment invalidateCache(), i haven't this error, but no ListGrid visual refresh.
Working...
X