Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make column hidden in jsGrid?

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}
    ]
like image 386
Shell Avatar asked Nov 27 '15 03:11

Shell


2 Answers

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);
like image 124
tabalin Avatar answered Nov 10 '22 10:11

tabalin


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.

like image 36
balachandar Avatar answered Nov 10 '22 10:11

balachandar