Announcement

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

    Expansion Component disappears from list grid.

    Expansion Component disappears from list grid when the expanded record is updated from a different view. The grid when queried on the expansion state of the record, states it is expanded yet the icon shows that it is not expanded and the component is missing.

    By attaching a data changed handler to the result set, I can see the updates when they come in. Calling grid.isExpanded at this time on the record returns true. Expanding the record at this time does not affect the end result.

    Waiting 5 seconds and the grid.isExpanded still returns true.

    It appears that the expansion canvas is getting lost in the redraw and the state of the grid no longer matches the actual view. Even collapseRecord followed by expandRecord fails to restore the expansion.

    My preference is to just have control via an api similar to setReselectOnUpdate and setReselectOnUpdateNotifications
    setReexpandOnUpdate and setReexpandOnUpdateBehavior
    createNew -- call getExpansionComponent and replace the component without events
    expand -- call getExpansionComponent and replace the component and send the expand event
    collapse_expand -- call collapseRecord and expandRecord with events.
    useOld -- recycle the exsisting component without updates or events.




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

    2. FF 30.0


    6.
    Code:
    @Override
    protected Canvas getExpansionComponent(ListGridRecord listGridRecord)
    {
        CustomView view = new CustomView();
        view.setData(listGridRecord);
        view.setMode(FormMode.VIEW);
        addListenerToForm(view);
        return view;
    }
    
    grid.addRecordExpandHandler(new RecordExpandHandler()
    {
    	@Override
    		public void onRecordExpand(RecordExpandEvent recordExpandEvent)
    		{
    			Integer id = recordExpandEvent.getRecord().getAttributeAsInt("id"));
    			if(id != null)
    			{
    				expandedRecordId = id;
    				GWT.log("record expanded");
    			}
    		}
    });
    		
    changes.addDataChangedHandler(new DataChangedHandler()
    {
    	@Override
    	public void onDataChanged(DataChangedEvent dataChangedEvent)
    	{
    		GWT.log("data changed");
            if(expandedRecordId != null)
            {
                final int index =  grid.findIndex(new AdvancedCriteria("id", OperatorId.EQUALS, expandedRecordId));
                final ListGridRecord record = grid.getRecord(index);
                boolean expanded = grid.isExpanded(record);
                grid.expandRecord(record);
                GWT.log("oldId: "+expandedRecordId+" wasExpanded: " + expanded+" index: " + index+
                        " rec.id: " + record.getAttribute("id")+ " isExpanded: "+grid.isExpanded(record));
                Timer time = new Timer()
                {
                    @Override
                    public void run()
                    {
                        GWT.log("OldId: "+expandedRecordId+" index: " + index +
                                " rec.id: " + record.getAttribute("id")+ " isExpanded: "+grid.isExpanded(record));
                    }
                };
                time.schedule(5000);
            }
    	}
    });
    changes.getRange(0, 75);
    Code:
    "oldId: 4 wasExpanded: true index: 0 rec.id: 4 isExpanded: true" 
    5 seconds later...
    "OldId: 4 index: 0 rec.id: 4 isExpanded: true"

    #2
    We're not reproducing this issue - however, it *is* feasible, possibly as a result of other settings on the grid - can you work your code snippets into a standalone testcase we can run?

    Ideally, just an EntryPoint that creates a grid and instructions to recreate the problem - you can use dummy, clientOnly dataSources if you need them.

    Comment


      #3
      This is the entire configuration of the grid.

      Code:
              grid = new ListGrid()
              {
      
      @Override
      protected Canvas getExpansionComponent(ListGridRecord listGridRecord)
      {
          CustomView view = new CustomView();
          view.setData(listGridRecord);
          view.setMode(FormMode.VIEW);
          addListenerToForm(view);
          return view;
      }
      }
              grid.setCanExpandRecords(true);
              grid.setCanExpandMultipleRecords(false);
              grid.setSelectionType(SelectionStyle.SIMPLE);
              grid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
              grid.setCanSelectAll(true);
              grid.setReselectOnUpdate(true);
              grid.setReselectOnUpdateNotifications(SelectionNotificationType.NONE);
              grid.setOverflow(Overflow.VISIBLE);
              grid.setBodyOverflow(Overflow.VISIBLE);
              grid.addSelectionUpdatedHandler(new SelectionUpdatedHandler()
              {
                  @Override
                  public void onSelectionUpdated(SelectionUpdatedEvent selectionUpdatedEvent)
                  {
                      if (grid.getSelectedRecords().length != 0)
                      {
                          //do stuff
                      }
                      else
                      {
                          //do other stuff
                      }
                  }
              });
              grid.setDataSource(dataSource);
              grid.setCanEdit(false);
              grid.setAutoFetchData(true);
              grid.setAutoFitWidthApproach(AutoFitWidthApproach.VALUE);
      
      field definitions
              grid.setFields(fields.toArray(new ListGridField[fields.size()]));
      The 11 list grid fields are text or boolean, though one does have a data path.
      The data that is changing isn't even one of the fields.

      The record expansion handler, the result set and it's data changed handler was to see what was going on and possible work around the expansion component disappearing.

      Comment


        #4
        This isn't a standalone sample that we can run - for instance, there's no dataSource and the code creates instances of a CustomView class that we don't have.

        We tested with the other settings you listed and we still see no issues. Editing an expanded record in an external DynamicForm with setImplicitSave(true) does not permanently remove the expansion component or put the record into a bad expansion state.

        It *does* collapse the record, and we'll take a look at whether that should be happening, but calling expandRecord() re-expands the record as expected.

        Given that your expansion component is custom (and that we don't have it), that is almost certainly where the problem lies. Please post a standalone test-case - see the instructions to the right of the box where you type your replies.

        Comment


          #5
          We've just made a change that should mean that records in your grid will remain expanded following an external update. Please retest with a build dated October 7 or later.

          Comment

          Working...
          X