0

I have a SmartGWT grid, where I want to display some data from JBoss-Server and it's grouped by one textfield that I fetch from JSON.

So, but I want this textfield only in the header of each group.

When I do .hideField on this field, then i'm loosing the group.

grid.hideField("pool");

But when i hide it over the context-menue of the grid header, the column remains.

Any idea how to do this?

Roman.

mmmmmm
  • 32,227
  • 27
  • 88
  • 117
Roman
  • 171
  • 1
  • 2
  • 16
  • I would think it worked for me in the past but forget where (I think I removed from my code for GUI reason, but I remember I used the setHidden on the field when I defined it and not on the grid (pool.setHidden(true) . Can you try? – Alain BUFERNE May 31 '12 at 16:09

5 Answers5

1

There is simple and clean workaround. Just set width parameter of the filed to '0'. Additionally clear title parameter if you have one (but this is only necessary in some sophisticated ListGrid use cases).

Daimonion
  • 61
  • 3
0

I've actually had the most success hiding the field using the DataSourceField as opposed to the grid itself.

DataSource ds = new DataSource() {
    {
        DataSourceTextField field = new DataSourceTextField();
        field.setHidden(true);

        addField(field);
    }
}
ModeEngage
  • 332
  • 2
  • 3
  • 13
  • I tried in my datasource: DataSourceTextField poolNameField = new DataSourceTextField("pool","Pool"); poolNameField.setHidden(true); addField(poolNameField); getting Javascript exception: groupBy() passed field:pool - this is not a valid field within this grid - ignoring pool is the field I use to group my grid, thats the problem – Roman Jun 07 '12 at 13:28
  • again: I tried in my datasource: `DataSourceTextField poolNameField = new DataSourceTextField("pool","Pool"); poolNameField.setHidden(true); addField(poolNameField);` in windowcode: `gridStats.setGroupByField("pool");` getting Javascript exception: **groupBy() passed field:pool - this is not a valid field within this grid - ignoring** pool is the field I use to group my grid, thats the problem – Roman Jun 07 '12 at 13:36
0

You've already posted here and didn't answer to the people who oriented you toward the setHidden methode of the ListGridField.

Community
  • 1
  • 1
Alain BUFERNE
  • 2,016
  • 3
  • 26
  • 37
0

The clean way is to hide the ListGridField like this:

    ListGridField groupField = new ListGridField(FLD_CATEGORY, "Group");
    groupField.setHidden(true);

Note that if you use a DataSourceField, you may need to declare hard-coded ListGridField definitions

Donatello
  • 3,486
  • 3
  • 32
  • 38
-1

below tag will help to hide table column listGrid.hideField("field_name");

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Amjad S. Mar 01 '22 at 13:47