javascriptjqueryjsgrid

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}
    ]

Solution

  • 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.