Hi, I am using IgGrid
i am facing one issue, when i have to edit the column value either 0 or 1
i have to able type 0.5 ect. how to avoid typing dot(.)
using the below code
name: "Updating", enableAddRow: false, enableDeleteRow: true, enableCheckBoxes: true, editMode: "row", autoCommit: true, columnSettings: [ { columnKey: "RXClub", editorOptions: {type: 'number', minValue: 0, maxValue: 1} }
]Thanks in advance
Robin Bronston D
Hello Robin,
Thank you for posting in our forum.
There are some minor modifications that have to be made to the code you have provided and it would prevent the user from being able to use floating-point numbers:
Here are two possible grid configurations: the first one has a number column that accepts only 0 and 1, and shows them without any additional formatting; the other one uses a boolean column instead and renders checkboxes.
I have provided the whole initialization configurations so you could see where the grid options have to be declared, and where the Updating ones should be:
A number column without checkboxes:
$("#grid").igGrid({ dataSource: ds, responseDataKey: "results", primaryKey: "ProductID", autoCommit: true, columns: [ { headerText: "Product ID", key: "ProductID", dataType: "number", width: "25%"}, { headerText: "Product Name", key: "ProductName", dataType: "string", width: "25%" }, { headerText: "Category", key: "CategoryName", dataType: "string", width: "25%"}, { headerText: "Available", key: "Available", dataType: "number", width: "25%" } ], features: [ { name: "Updating", editMode: "row", columnSettings: [ { columnKey: "Available", editorOptions: { dataMode: "int", minValue: 0, maxValue: 1 } } ] } ] })
A boolean column that shows checkboxes instead of zeroes and ones:
$("#grid").igGrid({ dataSource: ds, responseDataKey: "results", primaryKey: "ProductID", renderCheckboxes: true, autoCommit: true, columns: [ { headerText: "Product ID", key: "ProductID", dataType: "number", width: "25%"}, { headerText: "Product Name", key: "ProductName", dataType: "string", width: "25%" }, { headerText: "Category", key: "CategoryName", dataType: "string", width: "25%"}, { headerText: "Available", key: "Available", dataType: "bool", width: "25%" } ], features: [ { name: "Updating", editMode: "row" } ] })
If you need any additional assistance, feel free to contact me.