Hello everyone,
So i populated my grid with some data using my mvc. Now i want to add a dropdown (nommal and cascading one ) . I m confused how to do that. Also theres one condition if i select some value from dropdown i want to make other column required and optional on the basis of that.
Here's the code:
@*Batch Update*@<script> $(function () { $("#grid").igGrid({ primaryKey: "id", renderCheckboxes: true, autoGenerateColumns: false, updateUrl: "/Student/put/", width: "100%", columns: [ { headerText: "Student ID", key: "id", dataType: "number", width: "15%" }, { headerText: "Student Name", key: "name", dataType: "string", width: "30%" }, { headerText: "Marks", key: "marks", dataType: "number", width: "30%" }, { headerText: "Image", key: "imagepath", dataType: "string", width: "15%", template: "<img src='${imagepath}' width='50' height='50' />" }, { headerText: "Subject", key: "subject", dataType: "string", width: "15%" } ], dataSourceUrl: "/Student/Data12", dataSource: "/Student/Data", features: [ { name: "Selection", mode: "row", multipleSelection: true }, { name: "RowSelectors", enableCheckBoxes: true, enableRowNumbering: true }, { name: "GroupBy" }, { name :"Paging", type:"local", pageSize : 7 }, { name: "Filtering", columnSettings: [ { columnKey: "selectColumn", allowFiltering: false } ] }, { name: "Sorting", type: "remote", // sortUrlKey: 'sort', // sortUrlKeyAscValue: 'asc', // sortUrlKeyDescValue: 'desc' }, { name: "Updating", enableAddRow: true, editMode: "row", validation: true, enableDeleteRow: true, rowAdded: function (evt, ui) { // Custom logic to execute when a row is added console.log("Event arguments (ui):", ui); console.log("Row data:", ui.rowId); console.log(typeof (ui.values)); }, columnSettings: [ { columnKey: "id", readOnly: true }, { columnKey: "name", editorType: "text", validation: true, editorOptions: { validatorOptions: { required: { errorMessage: "You must enter a value to submit."
}, custom: function(ui,evt){ var validator = $("#grid").igGridUpdating("editorForKey", "name").data("igValidator").element; console.log(validator); if (ui == "rohit") { $(validator).igValidator("option", "errorMessage", "cant enter name rohit"); return false; } return true;
} } } }, { columnKey: "marks", editorType: "number", validation: true, editorOptions: { validatorOptions: { required: { errorMessage: "You must enter a value to submittt."
}, custom:function(ui,evt){ console.log(ui); console.log("hi"); if (ui >= 50 && ui<= 100) { var validator1 = $("#grid").igGridUpdating("editorForKey", "imagepath").data("igValidator").element; console.log("hi333"); var validator12 = $("#grid").igGridUpdating("editorForKey", "imagepath").data("igValidator");
console.log(validator12);
//Set $(validator1).igValidator("option", "required", true); return true; } } } } } ] } ] }); var editor = $("#grid").igGridUpdating("editorForKey", "id"); alert(editor);
$("#savechanges").on("click", function () { alert("Save button clicked"); // Save changes when the button is clicked $("#grid").igGrid("saveChanges"); }); });
</script>
}
I haven't added dropdown as i don't know how to do it. So, please help me out with this.
Thank you so much for the help.
retro bowl combines the best of classic football games with new management features. Explore our website to learn how you can become the best coach in the league!
Thanks to the developer's reply, I operated successfully after using the half body sexdoll method you provided, thanks for your contribution!
Thank you for all your responses. I'd also want to offer a really informative website.See More: slice masters
columnKey: "marks",editorType: "number",validation: true,editorOptions: {validatorOptions: {required: {errorMessage: "You must enter a value to submittt."
Can you explain this for me plz? super mario bros