Announcement

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

    Treegrid with checkbox : need to have a tooltip hover on a disabled node

    Hello!

    I have a checkbox-style treegrid with loadOnDemand data.
    this.treeGrid = new TreeGrid();
    this.treeGrid.setDataProperties(tree);
    this.treeGrid.setDataSource(dataSource);
    this.treeGrid.setAutoFetchData(true);
    this.treeGrid.setSaveLocally(false);
    this.treeGrid.setShowConnectors(false);
    this.treeGrid.setShowHeader(false);
    this.treeGrid.setShowOpener(true);
    this.treeGrid.setAlwaysShowOpener(true);
    this.treeGrid.setIconSize(0);
    this.treeGrid.setShowOpenIcons(false);
    this.treeGrid.setShowDropIcons(false);
    this.treeGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
    this.treeGrid.setSelectionProperty("checked");
    this.treeGrid.setSelectionType(SelectionStyle.MULTIPLE);
    this.treeGrid.setShowSelectedStyle(false);
    this.treeGrid.setShowPartialSelection(true);
    this.treeGrid.setCascadeSelection(true);

    To address my customer needs, some nodes have to be unupdatable by user (he must not be able to change the checkbox status). So I set these nodes to "disabled".
    But, the customer also needs to know why each unapdatable node is locked, so he wants a hover.

    I read several javadocs and forum topics and I understood that no event (so Hover event too) is thrown on any disabled node. So I tried to find any workaround.
    I read this old post and tried to use such a workaround but I didn't manage to succeed : https://forums.smartclient.com/forum...-disabled-rows

    Is their a way to implement something that suits my customer's needs?

    I am using smartgwtpro-5.0p_20151120 (and cannot upgrade easily to newer version due to customer policy)

    #2
    You can mark a particular record in a ListGrid (or node in a TreeGrid as unselectable) by setting the "recordCanSelectProperty" to false on the node.
    The attribute can be set on the node as supplied to the grid.
    So by default if you had "canSelect" set to false on the node, it would be unselectable. Or if you wanted another attribute name you already have configured on your data instead of "canSelect", you could set the recordCanSelectProperty on the grid.

    This should leave other events, including hover events, intact.

    Comment


      #3
      Thanks for the reply.
      I already tested this way but I did some mistake and it fails. Now I correct my mistake and it's OK: the node looks disabled but the hover is displayed. But I have a new issue :
      - for those unselectable nodes (where I forced "canSelect" to false) I need to have the checkbox displayed even if the user cannot use it.
      - but for some other unselectable nodes (some upper nodes that have not the same functional state for customer), the checkbox should not be displayed.
      Is there a way to do this? With CSS styles? Or other way?

      Comment


        #4
        We don't have a way to conditionally show checkboxes on nodes that are all non-selectable, and that seems a bit of a strange UI. It seems like end users will not understand what's going on, since the presence/absence of the checkbox doesn't seem to mean anything consistent. So our first recommendation would be to rethink your UI.

        Secondarily, you could use an (unsupported) hack: use an override of getBaseStyle() to style the tree cells in question with a differently CSS style that has an identical definition and just a different name. Then use a CSS selector rooted on that different style that targets the checkbox and makes it invisible (probably CSS visibility:"hidden"). This is a hack and not a supported one, because details of the DOM are undocumented and subject to change at any time (we need to change the rendered DOM frequently to work around browser bugs), so please don't ask for an example or further details.

        Comment

        Working...
        X