6
votes

I am using jsGrid in my project and now I am stuck here to hide a column that is being used in code but should not be displayed in page.

The grid I am using is : jsGrid

I have tried to take input control hidden but, still it doesn't work.

The following code is defines the columns of grid where I have taken hidden field for AccountID. but, it doesn't work.

Code:

fields: [
        { name: "Account", width: 150, align: "center" },
        { name: "Name", type: "text" },
        { name: "AccountID", type: "hidden", width: 0}
    ]
6

6 Answers

15
votes

Since v1.3 jsGrid fields have an option visible

http://js-grid.com/docs/#fields

If you need to hide (or show) a field at runtime, it can be done like the following:

$("#grid").jsGrid("fieldOption", "ClientName", "visible", false);
8
votes

Try this below code.

create a css class like below

.hide
{
   display:none;
}

And assign the css property to the field like below

fields: [
    { name: "Account", width: 150, align: "center" },
    { name: "Name", type: "text" },
    { name: "AccountID", css: "hide", width: 0}
]

Hope this will help you.

6
votes
fields: [
{ name: "Account", width: 150, align: "center" },
{ name: "Name", type: "text" },
{ name: "AccountID", visible: false, width: 0}]
1
votes
    fields: [{
            name: "<FIELD NAME>",
            visible: false
        }
    ]
0
votes

hidden very simple, make it like this example :

{ name: "id", title: "Id", type: "text", width: 1, css:"hide"}

where css class hide from bootsrap

0
votes

In my case we started our application to show a column in JSGrid and went all the way to production. Later there was a need to hide that column but I used that column to do custom sorting. So this is how I did

My styles

.idStyle:
{
  color: red;
} 

Created new style

.hiddenStyle: 
{
  display: none;
}

Below are my jsGrid Fields

var jsGridField = 
[
  { name: "Student ID", type: "text", width: "auto", css: "idStyle hiddenStyle" },
  { name: "Student Name", type: "text", width: "auto", css: "labelStyle" },
]