Test

Test

  • NA
  • 58
  • 50.9k

Unable to hide the datagrid columns using jquery

Aug 17 2019 3:03 AM
Below is my grid binding logic in this grid I need to hide Department column conditionally that means if(admin == true) I need to show this column or else I need to hide this column how can I do this
 
var Form = $("#Form1");
$("#Grid_1", Form).html("Loading....");
$("#Grid_1", Form).DataGrid({
DataUrl: baseApiURL + '/Controller/GetDetails',
PostData: { SP_VA_AUTH_NO: AuthNo }, GridId: "GridDetails", Loader: false, PageSize: 10,
Columns: [
{ HeadStyle: "width:55px;", Title: "Id", ItemKey: "Id", ItemNull: "N/A" },
{ HeadStyle: "width:80px;", Title: "Name", ItemKey: "Name", ItemNull: "N/A" },
{ HeadStyle: "width:200px;", Title: "Salary", ItemKey: "Salary", ItemNull: "N/A" },
{ HeadStyle: "width:75px;", Title: "Department", ItemKey: "Department", ItemNull: "N/A" }
]
});

Answers (4)