Announcement

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

    CheckBox Selecr/Deselect All

    Hi All,
    I need to allow multiselection in my list grid, so I am using:
    Code:
    vehicleList.setSelectionAppearance(SelectionAppearance.CHECKBOX);
    vehicleList.setSelectionType(SelectionStyle.SIMPLE);
    and the checkboxes are showing correctly on the records.

    The issue is when I click on the header of the checkbox column, the records are all selected, but then never deselected. Also, the header checkbox never shows as selected; it is always deselected.

    By comparing my code to SmartGWTShowCase2 (CheckboxSelect screen), I found out the difference is in getting the data.
    I am getting the data though the datasource (vehicleList.setDataSource(dataSource);) whereas in ShowCase2, the data is retrieved statically through: vehicleList.setData(CountryData.getRecords());

    If I set data statically, the checkbox works well.
    Is there a way I can make it work using my way of retrieving the data through a datasource?

    Appreciate your feedback.

    Thanks,

    Shad
    Last edited by shad; 21 Apr 2009, 23:22.

    #2
    You can't select all if only part of the data is loaded. Turn off data paging in this grid if selecting all data is a requirement.

    Comment


      #3
      Thanks Isomorphic for your feedback.

      I would like to point out that I am getting my data through RPC calls from the server, and the paging is done on the server side.
      In other terms, each page on the grid contains all the data to be loaded from the server for this page.

      How can I turn off paging on the grid to make it work with my current design?

      Thanks.

      Comment


        #4
        Fully loaded datasets allow select all to functional normally. If you aren't seeing this, be sure you have the latest code from SVN, then please post a standalone test case.

        Comment


          #5
          What do you mean by posting a standalone test case? Shall I provide you with more code?
          Also, please note that I have the latest code from SVN (21April).
          Thanks.

          Comment


            #6
            Hi,

            Below is the code I am using to build the grid and set the data:
            Code:
            private VehicleDS             dataSource;
            
            private ListGrid              vehicleList;
            
            dataSource = VehicleDS.getInstance();
            
            vehicleList = new ListGrid() {
                        protected MenuItem[] getHeaderContextMenuItems(
                                final Integer fieldNum)
                        {
                            if (fieldNum == 1)
                                return null;
                            final MenuItem[] items = super
                                    .getHeaderContextMenuItems(fieldNum);
            		return items;
                        }
                    };
                    vehicleList.setWidth100();
                    vehicleList.setHeight100();
                    vehicleList.setCanEdit(true);
                    vehicleList.setDataSource(dataSource);
                    vehicleList.setAlternateRecordStyles(true);
                    vehicleList.setSelectionAppearance(SelectionAppearance.CHECKBOX);
                    vehicleList.setSelectionType(SelectionStyle.SIMPLE);
                    vehicleList.setAutoFetchData(true);
                    vehicleList.setModalEditing(true);
                    vehicleList.setListEndEditAction(RowEndEditAction.NEXT);
                    vehicleList.setAutoSaveEdits(false);
                    vehicleList.freezeField(0);
                    vehicleList.setEditEvent(ListGridEditEvent.DOUBLECLICK);
                    vehicleList.setCanReorderFields(false);
                    vehicleList.setCanSort(false);
            vehicleList.setUseAllDataSourceFields(false);
                    vehicleList.setFields(formButton, vehicleKeyList, ownerKeyList,
                            descriptionList);
            listLayout.addMember(vehicleList);

            Comment


              #7
              A standalone test case is a single-file test case that we can simply run without modifications or additions, and that uses the minimal amount of code to reproduce the problem.

              Comment

              Working...
              X