Select to view content in your preferred language

Hiding a column in a dojox.grid.DataGrid

3581
4
10-07-2010 12:31 PM
GlenRhea
Emerging Contributor
I'm trying to hide a column in a datagrid because I'm using the objectid as a unique value to zoom to the graphic on the map. Obviously I don't want to display the objectid to the user so I'm trying to find a way to hide that column.

Here is what I've tried:
declaratively - <th field="1" hidden="true"></th> - no result
programmatically - grid.layout.setColumnVisibility(1, false); - hides the whole grid
css - <th field="1" style="display:none"></th> - no result

Any ideas?

I don't have this code published to the web yet but I can if needed.

The whole table:
<table dojotype="dojox.grid.DataGrid" jsid="grid" id="grid" ><thead><tr><th field="0" width="225px" >Results</th></tr><th field="1" hidden="true"></th></tr></thead></table>
0 Kudos
4 Replies
TONIFAIRBANKS
Regular Contributor

Did you ever figure out how to hide the Object ID field?

0 Kudos
KenBuja
MVP Esteemed Contributor

dGrid, the replacement for DataGrid, has a way to hide columns.

YungKaiChin
Regular Contributor

Like Ken Buja suggests, use dGrid instead.

With dGrid, you can hide a column when it is created or in css.

Since I don't know how to use DataGrid (anymore).

I think you may be able to use "hidden" as one of the parameters inside th tag with DataGrid.

Example:

<th ... hidden="true">Column Name</th>

<th ... hidden="false">Column Name</th>

TONIFAIRBANKS
Regular Contributor

Thanks.

0 Kudos