Announcement

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

    LISTGRID: Select ALL checkbox and Group By

    Hi,

    If I enable a groupby in a listgrid and use the CheckBox appearance for the selection, and if I click on the checkbox in the header to select all the records, the checkbox in the header does not get checked.
    If there is no groupby configured for the listgrid, it is checked as expected.

    Simple test case (with one of our datasource, but you can use any of course)

    Code:
    ListGrid grid = new ListGrid(DataSource.get(DSOperator.DS_NAME));
    grid.setAutoFetchData(true);
    grid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
    grid.setGroupByField(DSOperator.BUNIT_NAME);
    grid.setWidth(500);
    grid.setHeight(300);
    grid.show();
    Can this be fixed ?

    Many thanks,

    Thomas
    (We are using SmartGWT 4.0p)

    #2
    Please try this with the latest patched version, and please remember to always post your full version.

    Comment


      #3
      SGWT: 4.0p.0.0 05/14/2014 15:17
      FF: 26

      Code:
      public void onModuleLoad() {
      	new ListGrid() {{
      		setFields(new ListGridField("id", "ID"), new ListGridField("name", "Name"));
      		setData(createData());
      		setSelectionType(SelectionStyle.MULTIPLE);
      		setSelectionAppearance(SelectionAppearance.CHECKBOX);
      		setGroupByField("name");
      		setHeight(400);
      	}
      
      	private ListGridRecord[] createData() {
      		ListGridRecord[] records = new ListGridRecord[10];
      		for(int i = 0; i < 10; i++){
      			records[i] = new ListGridRecord();
      			records[i].setAttribute("id", i);
      			records[i].setAttribute("name", i % 2 == 0 ? "FOO" : "BAR");
      		}
      		return records;
      	}}.show();
      }
      Click select all. Expand BAR. Note that none of the BAR records are selected.
      Attached Files

      Comment


        #4
        We see this issue and are looking into it. We'll probably have a resolution today. We'll follow up here and let you know when its fixed.

        Regards
        Isomorphic Software

        Comment


          #5
          We've now made a change which we believe will address this issue. Please try the next nightly build dated May 16 or above

          Regards
          Isomorphic Software

          Comment


            #6
            Thanks!
            __________

            Comment


              #7
              SGWT: 4.0p.0.0 05/16/2014 11:15
              Throws the following exception when the select all check box is clicked.

              Code:
              10:32:32.757 [ERROR] [main] 10:32:32.771:MUP8:WARN:Log:TypeError: this.selection.$1462 is not a function
              Stack from error.stack:
                  ListGrid.updateCheckboxHeaderState() @ main/sc/modules/ISC_Grids.js:2233
                  GridBody.updateRowSelection() @ main/sc/modules/ISC_Grids.js:717
                  GridRenderer._rowSelectionChanged() @ main/sc/modules/ISC_Grids.js:582
                  GridRenderer._setSelectedObservation() @ main/sc/modules/ISC_Grids.js:581
                  anonymous() @ main/sc/modules/ISC_Core.js:47
                  thunk() @ main/sc/modules/ISC_Core.js:274
                  observation() @ main/sc/modules/ISC_Core.js:271
                  Selection.selectList() @ main/sc/modules/ISC_Grids.js:208
                  ListGrid.userSelectAllRecords() @ main/sc/modules/ISC_Grids.js:1436
                  ListGrid.headerClick() @ main/sc/modules/ISC_Grids.js:2237
                  ListGrid._headerClick() @ main/sc/modules/ISC_Grids.js:2236
                  isc.A.headerDefaults.itemClick() @ main/sc/modules/ISC_Grids.js:739
                  isc.A.buttonDefaults.click() @ main/sc/modules/ISC_Foundation.js:489
                  StatefulCanvas.handleActivate() @ main/sc/modules/ISC_Foundation.js:206
                  StatefulCanvas.handleClick() @ main/sc/modules/ISC_Foundation.js:207
                  [c]EventHandler.bubbleEvent() @ main/sc/modules/ISC_Core.js:1245
                  [c]EventHandler.handleClick() @ main/sc/modules/ISC_Core.js:1123
                  EventHandler._handleMouseUp() @ main/sc/modules/ISC_Core.js:1114
                  [c]EventHandler.handleMouseUp() @ main/sc/modules/ISC_Core.js:1106
                  [c]EventHandler.dispatch() @ main/sc/modules/ISC_Core.js:1278
                  anonymous() @ main/sc/modules/ISC_Core.js:46
                  unnamed() @ 
              
              
              com.smartgwt.client.core.JsObject$SGWT_WARN: 10:32:32.771:MUP8:WARN:Log:TypeError: this.selection.$1462 is not a function
              Stack from error.stack:
                  ListGrid.updateCheckboxHeaderState() @ main/sc/modules/ISC_Grids.js:2233
                  GridBody.updateRowSelection() @ main/sc/modules/ISC_Grids.js:717
                  GridRenderer._rowSelectionChanged() @ main/sc/modules/ISC_Grids.js:582
                  GridRenderer._setSelectedObservation() @ main/sc/modules/ISC_Grids.js:581
                  anonymous() @ main/sc/modules/ISC_Core.js:47
                  thunk() @ main/sc/modules/ISC_Core.js:274
                  observation() @ main/sc/modules/ISC_Core.js:271
                  Selection.selectList() @ main/sc/modules/ISC_Grids.js:208
                  ListGrid.userSelectAllRecords() @ main/sc/modules/ISC_Grids.js:1436
                  ListGrid.headerClick() @ main/sc/modules/ISC_Grids.js:2237
                  ListGrid._headerClick() @ main/sc/modules/ISC_Grids.js:2236
                  isc.A.headerDefaults.itemClick() @ main/sc/modules/ISC_Grids.js:739
                  isc.A.buttonDefaults.click() @ main/sc/modules/ISC_Foundation.js:489
                  StatefulCanvas.handleActivate() @ main/sc/modules/ISC_Foundation.js:206
                  StatefulCanvas.handleClick() @ main/sc/modules/ISC_Foundation.js:207
                  [c]EventHandler.bubbleEvent() @ main/sc/modules/ISC_Core.js:1245
                  [c]EventHandler.handleClick() @ main/sc/modules/ISC_Core.js:1123
                  EventHandler._handleMouseUp() @ main/sc/modules/ISC_Core.js:1114
                  [c]EventHandler.handleMouseUp() @ main/sc/modules/ISC_Core.js:1106
                  [c]EventHandler.dispatch() @ main/sc/modules/ISC_Core.js:1278
                  anonymous() @ main/sc/modules/ISC_Core.js:46
                  unnamed() @ 
              
                  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
                  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
                  at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
                  at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105)
                  at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
                  at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
                  at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292)
                  at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
                  at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
                  at java.lang.Thread.run(Thread.java:724)
              Thanks.

              Comment


                #8
                Very odd. Thanks for the notification. We're taking a look.

                Comment


                  #9
                  We've made a change to address this which will be present in the next nightly build in the 4.0 branch.
                  We'll also be removing this build from our download page.

                  As an aside: if you're doing new development we would recommend you upgrade to the latest stable release (4.1p) rather than continue to work on the 4.0p branch. If this is something you're considering, you can actually grab the latest 4.1p build right now - it shouldn't have this problem.

                  Regards
                  Isomorphic Software

                  Comment


                    #10
                    Thanks. We'll consider using 4.1 for our next release cycle.

                    Comment


                      #11
                      Almost there. All records are selected when selectAll checkbox is clicked but not when programatically selected.
                      Code:
                      @Override
                      public void onModuleLoad() {
                      	new VLayout(4){{
                      		final ListGrid grid = new ListGrid() {{
                      			setFields(new ListGridField("id", "ID"), new ListGridField("name", "Name"));
                      			setData(createData());
                      			setSelectionType(SelectionStyle.MULTIPLE);
                      			setSelectionAppearance(SelectionAppearance.CHECKBOX);
                      			setGroupByField("name");
                      			setHeight(400);
                      		}
                      		private ListGridRecord[] createData() {
                      			ListGridRecord[] records = new ListGridRecord[10];
                      			for(int i = 0; i < 10; i++){
                      				records[i] = new ListGridRecord();
                      				records[i].setAttribute("id", i);
                      				records[i].setAttribute("name", i % 2 == 0 ? "FOO" : "BAR");
                      			}
                      			return records;
                      		}};
                      		addMember(grid);
                      		addMember(new Button("Select All"){{
                      			setActionType(SelectionType.CHECKBOX);
                      			addClickHandler(new ClickHandler() {
                      				@Override
                      				public void onClick(ClickEvent event) {
                      					if(isSelected()) {
                      						setTitle("Unselect All");
                      						grid.selectAllRecords();
                      					} else {
                      						setTitle("Select All");
                      						grid.deselectAllRecords();
                      					}
                      					for(Record record : grid.getSelectedRecords()){
                      						SC.logWarn("{id: " + record.getAttribute("id") + ", name: " + record.getAttribute("name") + "}");
                      					}
                      				}
                      			});
                      		}});
                      	}}.show();
                      }
                      To reproduce:
                      click "select all"
                      expand "bar"
                      note that "bar" records are not selected.

                      Comment


                        #12
                        We've made a change for this one (already resolved in 5.0 but now packported to both 4.0 and 4.1)

                        Please try the nightly build dated May 20th and let us know if you still have the problem.

                        Thanks
                        Isomorphic Software

                        Comment


                          #13
                          Works. Thanks!

                          Comment

                          Working...
                          X