Announcement

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

    ListGrid: How to mark a row selected based on the value of a field?

    I have a ListGrid with the SelectionAppearance.CHECKBOX set. My question is: How to mark a row selected based on the value of a field?

    For example, I have a boolean field named "Selected" in the list grid record. When data is loaded in the ListGrid, I would like rows marked as selected for those which has the Selected field equal to true.

    Thanks.

    #2
    Easy! see http://www.smartclient.com/smartgwt/javadoc/com/smartgwt/client/widgets/grid/ListGrid.html#setSelectionProperty(java.lang.String)

    Code:
    setSelectionProperty
    
    public void setSelectionProperty(String selectionProperty)
                              throws IllegalStateException
    If specified, the selection object for this list will use this property to mark records as selected. In other words, if this attribute were set to "isSelected" any records in the listGrid data where "isSelected" is true will show up as selected in the grid. Similarly if records are selected within the grid after the grid has been created, this property will be set to true on the selected records.
    Note : This is an advanced setting
    
    Parameters:
    selectionProperty - selectionProperty Default value is null
    Throws:
    IllegalStateException - this property cannot be changed after the component has been created
    See Also:
    Appearance overview and related methods
    And a cool one which is related: setRecordCanSelectProperty if you don't want users to unselect a selected record.

    Comment


      #3
      Thanks a lot!

      Comment


        #4
        Can also use create record component.Override it.

        Comment

        Working...
        X