Announcement

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

    How to disable expansion/collapse feature of tree grid?

    I am using tree grid which can result in many rows. I had issues with scrolling but I fixed that by setting the setShowAllColumns and setShowAllRecords.
    But now I have issues with collapse/expansion. I looked for post and see that I need a kind of balance between scrolling and expansion/collapse. But I really don't have a great need to provide collapse/expansion feature. Can I disable these two? I think the one way to add the event handlers and return false. But then how to remove the +/- signs next to the node names?

    Thanks.

    #2
    Well like you said can cancel events for expansion and all. To eliminate the icons no straight forward method, but either different skin for that tree or through JSNI can accomplish the same thing with blank images to replace all the connectors.

    Comment


      #3
      Can you please help me in that? I mean the JSNI solution. I am also working on it. But if it's just a straight forward thing for you then I will appreciate your help a lot. Anyway thanks a lot for just giving the directions to start working on it.

      Comment


        #4
        Actually easiest way is to add this:
        Code:
        TreeGrid.setOpenerImage(null);
        TreeGrid.setShowConnectors(false);

        Comment


          #5
          Thanks a lot. I thought there should be a method to set these images null. somehow missed the method in API. Anyway it's working now as desired.

          Comment


            #6
            Yeah I was going set it through JSNI, but the method is already provided!

            Comment


              #7
              Can you please tell me what method should i override and what should be the body of these methods to disable collapse/expand feature ?

              Comment


                #8
                Code:
                TreeGrid.addFolderClosedHandler(new FolderClosedHandler() {
                	@Override
                	public void onFolderClosed(FolderClosedEvent event) {
                		event.cancel();
                	}
                });
                TreeGrid.addFolderOpenedHandler(new FolderOpenedHandler() {
                	@Override
                	public void onFolderOpened(FolderOpenedEvent event) {
                		event.cancel();
                	}
                });

                Comment


                  #9
                  Just updating this post with more information.
                  If you want to get rid of the +/- signs from the treegrid and still want to show the dotted connection between the nodes, then create the following images. These are same images as mentioned in bracket originally comes in with smartgwt style in images\TreeGrid directory.

                  nocollapse_ancestor.gif (connector_ancestor.gif)
                  nocollapse_end.gif (connector_end.gif)
                  nocollapse_middle.gif (connector_middle.gif)
                  nocollapse_opened_end.gif (connector_end.gif)
                  nocollapse_opened_middle.gif (connector_middle.gif)
                  nocollapse_opened_single.gif (connector_single.gif)
                  nocollapse_opened_start.gif (connector_start.gif)
                  nocollapse_single.gif (connector_single.gif)
                  nocollapse_start.gif (connector_start.gif)

                  and set
                  Code:
                  setOpenerImage(null);
                  setShowConnectors(true);
                  setConnectorImage("[SKIN]/nocollapse.gif")

                  Comment


                    #10
                    Enable after cancelling Folder open event

                    I need to do certain validations on click of expand and then expand based on result obtained. I have called event.cancel to cancell event. how to enable it?

                    Comment

                    Working...
                    X