jsgrid
jsgrid copied to clipboard
Prevent field (column) to "Edit" and/or "Include" depending on the selection previous?
- Help Request/Question: Hi
Any help will be welcome!
Prevent field (column) to "Edit" and / or "Include" depending on the selection in the previous selection:
Example:
-
If in the "Carga" field the Select option is "TIPO 01", the field "Value 01" MUST NOT allow Editing and/or Inclusion.
-
If in the "Carga" field the Select option is "TIPO 02", the field "Value 01" MUST allow Editing and/or Inclusion.
Thank you so much.
Set editing: true on grid, set editing: false on any field you don't want to be editable. Then use onItemEditing function:
$("#jsGrid").jsGrid({
width: "100%",
inserting: false,
editing: true,
sorting: false,
paging: true,
pageSize: 5,
pageButtonCount: 5,
confirmDeleting: false,
noDataContent: "Please Select a Service",
data: services,
onItemEditing: function(args) {
if(args.item.additionalfield == false) {
args.cancel = true;
}
},
fields: [
{name: "serviceid", title: "ServiceId", type: "text", visible: false },
{name: "service", width: 200, title: "Service", type: "text", editing: false },
{name: "additional_info", width: 300, title: "Additional Info", type: "text" },
{name: "additionalfield", width: 10, title: "Info Required", type: "text", visible: false },
{type: "control" }
]
});
This prevents the row from editing if additionalfield == false. Anything else is editable.
Hope that helps.