Announcement

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

    How to manually hide a row in a ListGrid?

    Using SmartGWT Pro 2.3
    GWT 2.0.4
    Google Chrome 6.0.472.63
    Mozilla Firefox 3.6.10

    Server specs:
    Ubuntu 8.04.4 LTS
    JBoss Web 2.1.1.CR3

    What I want is simple. I just want to be able to go through the rows in a ListGrid and set some to hidden.
    Pseudo code:
    listGrid.getRow(2).hide();

    If this is in the FAQ I'm going to shoot myself.

    #2
    too simple?

    Comment


      #3
      I once asked for the same, and I still need it. If you use the Search, you'll find the post.

      Best thing someone came up with (but I never used that) is adding a hidden boolean column e.g. "_visible" then add this with value true or false on every record, and add _visible=true criteria as a filter.
      Tacky, but might work, never tried it.

      Comment


        #4
        Criteria is the right way to hide rows, as it has all the right consequences in terms of pending edits, client vs server row numbering, etc.

        The alternative, for data that is supplied via setData() rather than via a DataSource, is to remove the row from the data itself.

        If neither seems like the right approach, please explain in detail what hiding the row means from the end user's perspective, and we can't suggest a different approach if needed.

        Comment


          #5
          levi,

          Unfortunately, I never figured out how to hide a ListGrid row. I did see your post before posting my own thread, and in hind sight probably should have just posted my question to your thread.

          Isomorphic,

          After trying to do things my way (simply hiding a row) I have already come to the same conclusion that criteria is the best way to go. All I'm trying to do is make a series of check boxes that filter the data in a ListGrid. I originally wanted to just make a view that would allow this functionality by simply using the ListGrid's filterData method and passing it criteria. However, our client wants to be able to filter data in many more ways than I had originally designed the program to be able to do. Writing a view that would include all of the data to filter by was pretty daunting, but I eventually caved and I'm almost through with the view. I'm having to write a few stored procedures and functions, but it seems to be getting there.

          As for the reason for wanting to manually hide rows, I was going to just write an RPC method that would return additional data about records present in the ListGrid and when a filter check box was selected the rows in the ListGrid that didn't match the filter would simply be hidden. However, the more I thought about it I came to realize that doing this was not the best approach because if they ever reloaded the grid (or scrolled it... paging) the SmartGWT framework would make these rows visible again. So, yes, I will use criteria.

          Sorry, to post an unnecessary question. Deadlines stress me out. I posted this long rant so that hopefully if anyone else goes through the same thought process they will see the problem and try to do it in a way that is more compliant with the framework.

          Comment


            #6
            Hi all,

            To complete previous post and explain the my need, here is my case: i have, like cliff.newton, a series of checkboxes that can select/deselect rows of the listgrid.

            I would like only the "selected" rows to be displayed all the time.

            For this, each time a checkbox is clicked, i clearAll criteria on list grid, then look for my rows to update (setEditValue() for each of them) then i put back the criteria in order to only show selected rows.

            It seems that edit values are taken into account at filtering time, right ?
            How can i do that ?

            Thanks!

            Comment


              #7
              Using SmartGWT 3.1p

              Is there a way to hide a row in a ListGrid that is not bound to a DataSource?

              How do you hide a record in a TreeGrid?

              BTW, I am looking for something like this, but that shows/hides the record:
              Code:
                  /**
                   * Default property name denoting whether this record is enabled. Property name may be  modified for some grid via {@link
                   * com.smartgwt.client.widgets.grid.ListGrid#getRecordEnabledProperty recordEnabledProperty}.
                   *
                   * @param enabled enabled Default value is null
                   * @see <a href="http://www.smartclient.com/smartgwt/showcase/#grid_interaction_disabled_rows" target="examples">Disabled rows Example</a>
                   */
                  public void setEnabled(Boolean enabled) {
                      setAttribute("enabled", enabled);
                  }

              Comment

              Working...
              X