Announcement

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

    ExpansionComponent auto collapse problem

    smartGWT: 4.1d Build date: Wed Feb 12 17:15:00 GMT 200 2014
    Linux Mint 14
    Firefox 25.01

    I've copied the code of the Smart GWT Showcase example Grids->Nested Form
    and made my own testcase
    Code:
    		final UserGroupDS usergroupDS = UserGroupDS.getInstance();
    		
        final ListGrid listGrid = new ListGrid() {
          @Override
          protected Canvas getExpansionComponent(final ListGridRecord record) {
    
              final ListGrid grid = this;
              VLayout layout = new VLayout(5);
              layout.setPadding(5);
    
              final DynamicForm df = new DynamicForm();
              df.setNumCols(4);
              df.setDataSource(usergroupDS);
              df.addDrawHandler(new DrawHandler() {
                  public void onDraw(DrawEvent event) {
                      df.editRecord(record);
                  }
              });
    
              IButton saveButton = new IButton("Save");
              saveButton.addClickHandler(new ClickHandler() {
                  public void onClick(ClickEvent event) {
                      df.saveData();
                  }
              });
    
              IButton cancelButton = new IButton("Done");
              cancelButton.addClickHandler(new ClickHandler() {
                  public void onClick(ClickEvent event) {
                      grid.collapseRecord(record);
                  }
              });
    
              HLayout hLayout = new HLayout(10);
              hLayout.setAlign(Alignment.CENTER);
              hLayout.addMember(saveButton);
              hLayout.addMember(cancelButton);
    
              layout.addMember(df);
              layout.addMember(hLayout);
              return layout;
          }
      };
    		
      listGrid.setWidth(600);
      listGrid.setHeight(500);
      listGrid.setDrawAheadRatio(4);
      listGrid.setCanExpandRecords(true);
      listGrid.setAutoFetchData(true);
      listGrid.setDataSource(usergroupDS);
      
      ListGridField nameField = new ListGridField("name");  
      ListGridField descriptionField = new ListGridField("description");  
    
      listGrid.setFields(nameField, descriptionField);   
      
      listGrid.draw();
    The problem is when you save the expanded record, it automatically collapse the record.
    The code did not do that in version smartGWT 3.1p.

    Interesting enough the exact code seems to work in the showcase example.(It does not auto collapse)

    Is there a new setting to prevent the auto collapse or is it a problem in the current version ?

    #2
    ExpansionComponent collapse on saveData()

    I have tried it with the latest nightly build:
    smartGWT version: 4.1p Build date: Sun Mar 02 16:39:00 SAST 2014
    but the problem persists.

    Comment


      #3
      We're not seeing this with the ItemSupplyXmlDS the original sample uses - please show your DataSource

      Comment


        #4
        Thanks for steering me in the right direction.

        The problem was on my server side code.

        Previously, on an update, I returned the updated record's data via the specified RestDatasource XML.

        By commenting out the return XML, fixed the problem.

        Thanks again for the help

        Comment

        Working...
        X