I have a grid that allows users to enter a payment amount, however I want the validator to allow up to the amount due.
So consider the following column setting (code snipped for brevity)
update.ColumnSetting().ColumnKey("AmountToPay") .EditorType(ColumnEditorType.Currency) .Required(true) .Validation(true) .EditorOptions("button:'spin', maxValue:0"); // Is there anyway to set the max value equal to the value of another column called "AmountDue" which is also in the grid?
Hi, Please let me know where we can set maxvalue option in IG combo as we set in ig textbox editor
Hi,
You can acomplish your goal by hooking to the igGridUpdating's editCellStarted event and in it set the max value of the AmountToPay column based on the value of cell for the AmountDue column on the same row (getting that using the igGrid's getCellValue API method).
Since you're using MVC, you need to use jQuery's live function in order to hook to the afore-mentioned event like so:
$("#grid1").live("iggridupdatingeditcellstarted", function(evt, ui) { if(ui.columnKey == "AmountToPay") { $(ui.editor).igEditor("option", "maxValue", ui.owner.grid.getCellValue(ui.rowID, "AmountDue")); } });
PS: Our help article on event handling will also help you understand the logic I'm using.PPS: I'm attaching a simple HTML page which shows this solution in action - feel free to download it and give it a go.
Cheers,Borislav