Announcement

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

    treegrid openFolder / icon click handler

    Hi -
    Is there a handler that fires when opening a load on demand treegrid node before the data is fetched? Or a handler that fires when the user clicks on the open/close icon?
    It seems that the FolderOpenedHandler fires after the data is fetched and neither folderClickedHandler nor nodeClickedHandler fire when clicking the open/close icon.

    #2
    RowClick fires, and you can detect whether the click is in the opener area with inOpenArea().

    Comment


      #3
      A quick followUp. We realize our wording is confusing here - to add a click handler you'll want to use addRecordClickHandler() or addCellClickHandler() rather than actually using "RowClick".
      Sorry for the confusion. Let us know if this doesn't achieve what you need.

      Regards
      Isomorphic Software

      Comment


        #4
        It doesn't appear that cellClick fires when I click the +/- icon - only on an actual cell. I played around with the sample @:
        http://smartclient.com/docs/8.3/a/system/reference/SmartClient_Explorer.html#nodeTitles ( under suggestion that perhaps rowClick simply wasn't wrapped for SmartGWT)

        and it doesn't seem that rowClick fires either. Maybe I'm doing something wrong?

        Some background on the actual underlying "problem" I'm trying to solve - as perhaps I'm overlooking something easier:

        In our app - we've disabled the prompt on most datasources, as some of them take a long time to query and we want the user to be able to interact with the app ( maybe check another tab, for instance ). The problem is, there's no visual feedback to the user when they've clicked the expand icon. So they click, wait a second and then click again - which then closes the node when the data actually arrives. I figured if I intercepted the "+" click - I could then replace the icon for that record with the loading icon (loadingSmall.gif from your skin). When data arrives, I can change the icon back to its previous value..

        Any chance I’m over-complicating things ? or just missing the simple function that does this( or something similar) ?

        Comment


          #5
          Ah - sorry for the confusion
          There's a folderOpenedHandler and a folderClosedHandler you should be able to use to react to the user clicking on the +/- icons to expand and collapse folders.
          You could call getLoadState() on the TreeGrid's data object (a Tree) to determine whether the folder in question has been loaded. There's also dataArrived which should fire when the folder's children actually load. This should give you enough to react to the user interaction and show some custom feedback to the user while the children are loading.
          Alternatively there may be a more simple approach altogether. You could probably handle this by simply passing a DSRequest with showPrompt set to true into your initial "fetchData()" call for the TreeGrid. The operation properties will be retained for subsequent fetches as data is loaded on demand so the prompt should just show up as the user opens the folders.

          Comment


            #6
            Ah - it seems that the folderOpened handler does fire before the data is returned. It's just that the TreeNode.setIcon("---") wasn't reflected in the UI until the gird was redrawn - which in this case wasn't until after the data returned. A call to:
            markForRedraw() after changing the icon was all I needed.
            thanks!

            Comment

            Working...
            X