jQuery UI Widgets › Forums › Grid › Toggle grid as editable based on condition
Tagged: angular grid, angular2 grid, bootstrap grid, javascript grid, jquery grid, jqwidgets grid, jqxgrid, typescript grid
This topic contains 3 replies, has 2 voices, and was last updated by Hristo 7 years, 8 months ago.
-
Author
-
Is there a way to set the true/false of the grid editable property based on a condition (ie the variable IsAdmin=’Y’)
$("#jpxgridUsers").jqxGrid({ width: '95%', source: gridDataAdapter, selectionmode: 'multiplerowsextended', sortable: true, pageable: true, autoheight: true, columnsresize: true, pagesize: 20, pagermode: 'default', showfilterrow: true, filterable: true, altrows: true, enabletooltips: false, editable: true, columns: [ { text: 'Employee ID', dataField: 'EmployeeID', cellsalign: 'left', align: 'left', editable: false, cellclassname: cellclass }, { text: 'First Name', dataField: 'FirstName', cellsalign: 'left', align: 'left', cellclassname: cellclass }, { text: 'Last Name', dataField: 'LastName', cellsalign: 'left', align: 'left', cellclassname: cellclass }, { text: 'Login', dataField: 'Login', cellsalign: 'left', align: 'left', cellclassname: cellclass }, { text: 'Admin', hidden: 'true', dataField: 'IsAdmin', cellsalign: 'left', align: 'left', cellclassname: cellclass }, { text: 'Active', hidden: 'true', dataField: 'IsActive', cellsalign: 'left', align: 'left', cellclassname: cellclass }, { text: 'Admin', dataField: 'IsAdminNumeric', width: '5%', cellsalign: 'center', align: 'center', columntype: 'checkbox' }, //, cellclassname: cellclass, cellbeginedit: cellbeginedit { text: 'Active', dataField: 'IsActiveNumeric', width: '5%', cellsalign: 'center', align: 'center', columntype: 'checkbox' } //, cellclassname: cellclass, cellbeginedit: cellbeginedit ] });
I got it by setting a variable to true or false and setting editable: vIsEditable
I forgot to set async: false on my json that was setting the variable so the grid code was loading before the variable was set.
Hello sjkcwatson,
You could use the approach as in this example.
If you mean to change dynamically the state of the Grid – to switch between editable: true/false. You could use$('#jqxgrid').jqxGrid({ editable: false});
Hope this helps.Best Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.