Announcement

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

    TreeGrid - Highlighted record clicked (not "selected"/checked)

    Using 6.0 open
    I have a TreeGrid having setSelectionAppearance(SelectionAppearance.CHECKBOX);

    I we want the row clicked (not necessarily checked) to remain highlighted until another row is clicked.
    Setting setShowSelectedStyle(true); does not work because "selected" means checked.
    What I'm looking for is "setShowClickedStyle(true)" but that function does not exist.

    Is there an API method to set the clicked row style? Or do we need to bake our own using addCellClickHandler(new CellClickHandler() ... <row selected style code>... ?

    Thanks in advance for pointers.
    -Tom



    #2
    There's no such thing as a "clicked style" in any of the built-in selection behaviors of the grid. A grid row is selected or it isn't.

    At this point, you seem to have two different selection-type concepts going on in parallel - one represented by checkboxes, one represented by a separate kind of highlighting created by clicking the row not on the checkbox. What you may want to do is use grid selection *without* checkbox appearance, which will cause styling when a row is selected by clicking anywhere on that row, then introduce a field of type "boolean", which will give you a column of checkboxes that are unrelated to selection and just affect a data field in each record (see also listGridField.canToggle).

    Comment


      #3
      Yeah, a totally natural concept. The record (along with 10 sister records) is ON (checked), but now I want to click on one record, and visually indicate to the user that THIS record is selected.
      The user's eye leaves the TreeGrid, then returns later to be reminded of which record (of several checked records) is selected.

      I can try your suggestion, but things won't look clean. Maybe I can change the style, or the icon of a selected, I mean clicked, record.

      Thanks for your response!

      Comment


        #4
        Well, it looks like you are trying to get the ListGrid's selection system to represent two different states at once (selected and what you called "ON"). The selection system just represents selection (of course), but the ListGrid has dozens of APIs that allow you to control styling based on other pieces of information (like your "ON" state). So you should explore the docs and samples for those APIs.

        Comment

        Working...
        X