Announcement

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

    ListGrid headers and fields data mismatch when setShowFilterEditor(true)

    Hi,

    after spending a considerable amount of time, trying to figure out where I was wrong, and even starting a separate thread (http://forums.smartclient.com/showthread.php?t=17863) I come up with the following issue.

    If you have filter editors allowed for your ListGrid component (setShowFilterEditor(true)),
    and if you have executed at least one time setViewState method, and after that you try for instance to manually reorder any columns - the headers's and fields datas become unmatched, and filter editor fields are incorrectly drawn.

    Everything works properly if there are no filter editors allowed (setShowFilterEditor(false)).

    I guess it could have some common roots with http://forums.smartclient.com/showth...erences+filter thread.

    So, here's the sum up:

    SmartGwt library: smartgwtee-2.5 nightly build from 2011-06-30

    conditions:
    1. setShowFilterEditor(true)
    2. setViewState is executed once, at least

    action: column reordering

    result: data in headers and fields mismatch each other, filter editors are incorrectly drawn.

    Thanks!
    Last edited by vasbork; 15 Jul 2011, 02:31.

    #2
    Sorry you hit this, this was fixed about 2 days ago.

    Comment


      #3
      Thanks for response,

      I've tried nightly build from 2011-07-13(latest available at the moment). The result is the same as with one from 2011-06-30.

      Perhaps, the corrected build has not yet arrived.

      Again, it works perfectly with disabled filter editors (setShowFilterEditor(false)).

      Cheers.
      Last edited by vasbork; 16 Jul 2011, 07:31.

      Comment


        #4
        The correction is already in the build you downloaded. If you think there might be a second bug, please create a minimal test case that we can run to see the problem,

        Comment


          #5
          Ok, here it is.

          I tried it with smartgwtee-2.5 nightly build from 2011-07-13 under OS X 10.6.8 (Firefox 4 and 5, Safari 5.05, Chrome 12.0.742.122) and Windows XP (Chrome 12.0.742.122, IE 8.0.6001).

          If you don't press the button, which calls setViewState method, it's all nice. You can reorder columns by dragging them, and it works perfectly. Each time the ViewStateChangedHandler is called, it saves grid's view state to some "viewState" string.

          If you press the "Set view state" button, the setViewState method sets the grid's view state with value that was saved in the "viewState" string. If you try to reorder columns after that, that's when the mess begins.

          The two pictures attached to this message show grid's reaction to columns reordering before(1.png) and after(2.png) the button was pressed.

          Commenting out the
          Code:
          //testGrid.setShowFilterEditor(true);
          line resolves column reordering problem.

          Sample code:

          Code:
            DataSource ds = null;
            String viewState = null;
            ListGrid testGrid = null;
            
            private void saveViewState() {
              viewState = testGrid.getViewState();
            }
          
            private void restoreViewState() {
              testGrid.setViewState(viewState);
            }
          
            public void onModuleLoad() {
              ds = DataSource.get("mytest");
              testGrid = new ListGrid();  	
              testGrid.setWidth(320);
              testGrid.setHeight(200);
              testGrid.setWrapCells(true);
              testGrid.setDataSource(ds);
              testGrid.setCanEdit(true);
              testGrid.setModalEditing(true);
              testGrid.setShowFilterEditor(true);
              testGrid.setAutoFetchData(true);
          
              testGrid.addViewStateChangedHandler(new ViewStateChangedHandler() {
                @Override
                public void onViewStateChanged(ViewStateChangedEvent event) {
          	saveViewState();
                }
              });
            	
              ListGridField field1 = new ListGridField("texts", 100);
              ListGridField field2 = new ListGridField("dates", 100);
              ListGridField field3 = new ListGridField("ints", 100);
          
             testGrid.setFields(field1, field2, field3);
          		
             IButton testButton = new IButton("Set view state");
             testButton.addClickHandler(new ClickHandler() {
               public void onClick(ClickEvent event) {
                 restoreViewState();
               }
             });
            	
            VLayout layout = new VLayout();
            layout.setMembersMargin(15);
            layout.addMember(testGrid);
            layout.addMember(testButton);
            layout.draw();
          }
          Data source:

          Code:
          <DataSource ID="mytest" serverType="sql" tableName="mytest" testFileName="mytest.data.xml">
          
            <fields>
                <field name="texts" type="text" />
                <field name="dates" type="date" />
                <field name="ints" type="integer" />
            </fields>
          
          </DataSource>
          Test data:

          Code:
          <List>
          
              <Object>
          	<texts>texts value1</texts>
                  <dates>1970-01-01</dates>
                  <ints>1</ints>
              </Object>
          
              <Object>
                  <texts>texts value2</texts>
                  <dates>2000-01-01</dates>
                  <ints>2</ints>
              </Object>
          
              <Object>
                  <texts>texts value3</texts>
                  <dates>2030-01-01</dates>
                  <ints>3</ints>
              </Object>
          
          </List>
          Attached Files
          Last edited by vasbork; 17 Jul 2011, 05:11.

          Comment


            #6
            We're not reproducing this - can you verify with the latest build (July 18). If you do still see it - try clearing browser cache, and running a GWT Compile on the project and refreshing. (And double-check the date reported at the bottom of the developer console to ensure you really are seeing the latest, fresh build).

            If the problem does persist, let us know and we can take another look. Probably best in this case to include exact steps to reproduce, and all details of your environment (Are you using Eclipse, or ant to build the sample; GWT version; browser / OS, etc)

            Thanks
            Isomorphic Software

            Comment


              #7
              Hi,

              with the new 2011-07-18 build it works correctly now. Just replaced the jars, and it all came to normal.

              Thanks!

              Comment

              Working...
              X