Announcement

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

    ListGrid Multiple Select - get Fields / Columns

    Hi,

    just started using SmartGWT 2.4 and came over a question:

    I created a ListGrid and added a SelectionHandler to enable selecting some items. I would like to get the selected Columns or selected Fields. (Finally an Array containing the selected fields).

    As the SelectionEvent doesn't provide this information, I am wondering if there is any other approach to get the (range of the) Selected fields.

    #2
    The CubeGrid component supports cell-level selection. The ListGrid does not have a notion of selecting individual fields, just records.

    Comment


      #3
      Thanks for your post! It seems that CubeGrid is only available in the Enterprise Edition. Is there no possibility to select cells in the free edition?

      Comment


        #4
        hi ,there are two methods ,

        ListGridRecord[] getSelection()
        The selection associated with the listGrid.
        ListGridRecord[] getSelection(boolean excludePartialSelections)
        The selection associated with the listGrid.

        check this,hop this may be ur requirement

        Comment


          #5
          Thanks,

          this only returns the records - i want to get returned the Cells(Fields).

          Comment


            #6
            Check this

            First you use the previous method and get all selected records,
            then u getcellstyle of the columns ,if selected state ,do ur operation

            check the method description
            getCellStyle

            protected String getCellStyle(ListGridRecord record,
            int rowNum,
            int colNum)

            Return the CSS class for a cell. By default this method has the following implementation:
            - return any custom style for the record (see recordCustomStyleProperty) if defined.
            - create a style name based on the result of GridRenderer.getBaseStyle and the state of the record.
            The state of the record is indicated by adding a suffix to the base style. There are four independent boolean states, which are combined in the order given:

            1. "Disabled" : whether the cell is disabled; enable by setting the "enabled" flag on record returned by getCellRecord
            2. "Selected" : whether cell is selected; enable by passing a Selection object as "selection"
            3. "Over" : mouse is over this cell; enable with showRollovers
            4. "Dark" : alternating color bands; enable with alternateRowStyles

            For example, with a baseStyle of "myCell", a cell which is selected, which the mouse is over, and which is in a dark-colored band will get a styleName of myCellSelectedOverDark.

            Cell Styles customizable by:

            * attaching a custom style to a record by setting record[this.recordCustomStyleProperty] to some valid CSS style name.
            * modifying the base style returned by getBaseStyle() [see that method for further documentation on this]
            * overriding this function

            "Selected" style can be ignored by setting showSelectedStyle to false.
            Note: This is an override point

            Parameters:
            record - record object for this row and column
            rowNum - number of the row
            colNum - number of the column

            Comment


              #7
              Check this api docs

              for all method description

              http://www.smartclient.com/smartgwt/.../ListGrid.html
              Last edited by vinuriyer; 24 Mar 2011, 01:07.

              Comment


                #8
                Thanks for your reply but there doesn't seem to be any possibility to select single or multiple cells instead of records / rows in ListGrids.

                Comment


                  #9
                  ohh..

                  As the admin says about that cubegrid is only way to select that..
                  I have used row selection not cell selection,ok

                  hop u have tried the cellstyle way..
                  Try any another approach or customize it..

                  Comment

                  Working...
                  X