jQWidgets Forums
jQuery UI Widgets › Forums › Grid › make cell editable depending on value of another cell in the same row
Tagged: angular grid, bootstrap grid, grid editable value, javascript grid, jquery grid, jqwidgets grid, jqxgrid
This topic contains 2 replies, has 2 voices, and was last updated by Hristo 9 years, 2 months ago.
-
Author
-
March 25, 2016 at 6:36 pm make cell editable depending on value of another cell in the same row #82852
I want to make a cell editable depending on value of another cell in the same row.
If the value of cell “linkORfile”===”file” then the cell “linkHref” it NOT editable. If “linkORfile”===”link” then it IS editable.
My code doesn’t work.$("#eLinks").jqxGrid( { width: 800, height: 200, source: dataAdapter, editable: true, columns: [ { text: 'ID', datafield: 'lID',width: "7%",editable: false}, { text: 'link description', datafield: 'linkName',width: "29%",editable: true}, { text: 'HREF', datafield: 'linkHref',width: "28%",editable:true, cellsrenderer: function (row) { var dataRecord = $("#eLinks").jqxGrid('getrowdata', row); var FL=dataRecord.linkORfile; if(FL==="file"){ $("#eLinks").jqxGrid('endcelledit', row, "linkHref", false); } } }, { text: 'type', datafield: 'linkORfile',width: "20%",editable: true, columntype: 'dropdownlist', initeditor: function (row, cellvalue, editor) { editor.jqxDropDownList({ source: dropdownListSource}); } }, { text: 'save', datafield: 'edit', width: "8%", columntype: 'button', cellsrenderer: function () { return "Save"; }, buttonclick: function (row) { var dataRecord = $("#eLinks").jqxGrid('getrowdata', row); clog(dataRecord.linkORfile); } }, { text: 'delete', datafield: 'delete', width: "8%", columntype: 'button', cellsrenderer: function () { return "Delete"; }, buttonclick: function (row) { var dataRecord = $("#eLinks").jqxGrid('getrowdata', row); clog(dataRecord.linkORfile); } } ] });
March 25, 2016 at 6:52 pm make cell editable depending on value of another cell in the same row #82855one other thing I’d like to do: If the value of the cell ‘linkORfile’ changes, I want to change the editable state of ‘linkHref’ as well.
How?
March 28, 2016 at 7:43 am make cell editable depending on value of another cell in the same row #82884Hello shawn,
We have one similar theme, that will be helpful:
http://www.jqwidgets.com/community/topic/allow-cells-to-be-editable-only-under-specific-conditions/#post-52955
You could find more in our forum.About second question you could use
cellsrenderer
member from columns property of the Grid.
Please, take a look this demo:
http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/defaultfunctionality.htm?lightBest Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.