Announcement

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

    List Grid does not reselect on update when given a result set.

    ListGrid.setReselectOnUpdate(true) is not functional when a result set is given to the grid versus allowing the grid to create on with a criteria.

    The grid acts as if the reselect is false.


    1. SmartClient Version: v9.1p_2014-09-24/PowerEdition Deployment (built 2014-09-24)

    2. FF 30

    6.
    Code:
    //        This api is non-functional if a resultSet is given as data versus fetched by the grid
    //        grid.setReselectOnUpdate(true);
    //        grid.setReselectOnUpdateNotifications(SelectionNotificationType.NONE);
            grid.setAutoFetchData(false);
            grid.setData(resultSet);

    #2
    We're not reproducing this problem with our test case.
    Here's some test code - can you verify whether this code causes the problem in your environment? This code uses one of our shipped DataSources, the supply-item DS, but you could easily make slight changes to work with another dataSource if that's more convenient for your testing.
    To perform the test, load the app, select a record, and hit the button.
    An update operation is performed against the dataSource, and (in our testing at least), the record is reselected as expected.

    If it does show the problem in your environment, please try with the latest nightly build (it's possible, though a little unlikely given how recent your build is, that you're hitting an already fixed bug).
    If the problem doesn't appear with this test code, we'll need a way to reproduce it. (Or at least as much information as you can give us about your setup, and any warnings you see logged, etc)

    Code:
    	public void onModuleLoad () {
    		final DataSource supplyItem = DataSource.get("supplyItem");
    		
    		final ListGrid testGrid = new ListGrid();
    		testGrid.setDataSource(supplyItem);
    		testGrid.setWidth(500);
    		testGrid.setHeight(200);
    		
    		testGrid.setReselectOnUpdate(true);
    		
    		testGrid.draw();
    		
    		ResultSet testRS = new ResultSet();
    		testRS.setDataSource(supplyItem);
    		
    		testGrid.setData(testRS);
    		
    
    		// Button to perform a DS update
    		Button update = new Button("Update");
    		
    		update.addClickHandler(new ClickHandler() {
    			
    			public void onClick(ClickEvent event) {
    				Record updatedRecord = new Record();
    				updatedRecord.setAttribute("itemID", testGrid.getSelectedRecord().getAttribute("itemID"));
    				updatedRecord.setAttribute("nextShipment", new Date());
    				
    				supplyItem.updateData(updatedRecord);
    			}
    		});
    		
    		update.setTop(400);
    		update.draw();
    
    	}
    Thanks
    Isomorphic Software

    Comment


      #3
      First the entire grid configuration in case settings are the issue:
      Code:
         grid = new ListGrid(DataSource)
              {
                  @Override
                  protected Canvas getExpansionComponent(ListGridRecord listGridRecord)
                  {
      				// form
                  }
              };
              grid.setCanExpandRecords(true);
              grid.setCanExpandMultipleRecords(false);
              grid.setSelectionType(SelectionStyle.SIMPLE);
              grid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
              grid.setCanSelectAll(true);
              grid.setOverflow(Overflow.VISIBLE);
              grid.setBodyOverflow(Overflow.VISIBLE);
              grid.addSelectionUpdatedHandler(new SelectionUpdatedHandler()
              {
                  @Override
                  public void onSelectionUpdated(SelectionUpdatedEvent selectionUpdatedEvent)
                  {
                      if (grid.getSelectedRecords().length != 0)
                      {
                          // deal with buttons
                      }
                  }
              });
      //        This api is non-functional if a resultSet is given as data versus fetched by the grid
      //        grid.setReselectOnUpdate(true);
      //        grid.setReselectOnUpdateNotifications(SelectionNotificationType.NONE);
              grid.setAutoFetchData(false);
      		grid.setData(resultSet);
              grid.setFilterLocalData(true);

      Second:
      Instead of
      supplyItem.updateData(updatedRecord);
      Try
      DSResponse response = new DSResponse();
      response.setData(new ListGridRecord[]{updatedRecord});
      DSRequest request = new DSRequest();
      request.setDataSource("supplyItem");
      request.setOperationType(DSOperationType.UPDATE);
      ds.updateCaches(response, request);

      As to simulate: https://isomorphic.atlassian.net/wiki/display/Main/How+to+propagate+data+source+changes+to+all+clients+by+using+the+Real-Time+Messaging+Module

      Comment


        #4
        We've made the changes you suggest to attempt to reproduce this, and still no joy.
        Probably the best thing to do is to put together a minimal standalone test case we can run which demonstrates the problem.

        Regards
        Isomorphic Software

        Comment

        Working...
        X