Hello everyone,
So i was using a code provided in forum the grid id getting displayed but it is not getting populated with data.Could you help me out alittle.I wanted to make the grid and apply some validation like if previous field eg marks have marks less than 50 so we date is optional else required.Also i want to apply filter manullay for date is it possible and i want to display only month years if that is possible.
<html> <head>
</head>
<body> <table id="grid"></table> </body>
</html>
@section scripts{ <script> $(document).ready(function () { var testData = [ { "ID": 1, "Name": "Name 1", "ExpireDate": new Date() }, { "ID": 2, "Name": "Name 2", "ExpireDate": new Date() }, { "ID": 3, "Name": "Name 3", "ExpireDate": new Date() }, { "ID": 4, "Name": "Name 4", "ExpireDate": new Date() }, { "ID": 5, "Name": "Name 5", "ExpireDate": new Date() }, { "ID": 6, "Name": "Name 6", "ExpireDate": new Date() } ]; $("#grid").igGrid({ height: "100%", width:"100%", dataSource: testData, columns: [ { headerText: "ID", key: "ID", dataType: "number", width: "50%" }, { headerText: "Name", key: "Name", dataType: "string", width: "25%" }, { headerText: "Expire Date", key: "ExpireDate", dataType: "date", width: "25%" } ], autoGenerateColumns: false, primaryKey: "ID", features: [ { name: "Updating", editMode: "row", columnSettings: [ { columnKey: 'ExpireDate', required: false, editorType: 'datepicker' } ], editCellStarting: function (evt, ui) { // Do not let users edit even numbered rows. if (ui.columnKey == "ExpireDate" && ui.rowID % 2 == 0) return false; } } ] }); }); </script> }
To replicate your behavior using de-populated data, I've been exploring your question and prepared a short sample. With igGrid, your code snippet works. The grid shows and data is bound and filled regardless of autoGenerateColumns. Perhaps another parameter or custom logic is causing the described behavior. geometry dash
Hello,
I have been looking into your question and I have created a small sample trying to reproduce the described behavior with the not populated data. I am using igGrid and I am using your code snippet. On my side everything works as expected and the grid is displayed as well as the data is bound and populated in the grid as expected regardless of whether autoGenerateColumns is set to true or false. Maybe there is something else you are setting or applying some custom logic that is causing the described behavior.
Regarding your second question, what I can say is that when defining the updating feature, you decided that the edit mode of the igGrid should be row editing, after which you handle, however, the editCellStarting event, which is fired when editing of a cell starts, not of a row. After that, you check if the row is even and if the cell being edited is from the ExpireDate column, that's why the described behavior also causes that only certain cells from the ExpireDate column of the even rows cannot be edited.
editCellStarting: function (evt, ui) { if (ui.columnKey == "ExpireDate" && ui.rowID % 2 == 0){ return false; } }
What you need to do is to handle the editRowStarting event, which is fired when the editing of the entire row is started, then check whether the row is even or not, and if it is even, stop the editing by returning false, and if it is odd, the editing will continue for the corresponding row
editRowStarting: function (evt, ui) { if (ui.rowID % 2 == 0){ return false; } }
What needs to be clarified is that editCellStarting and editRowStarting are cancellable events, that is, when they fire, you can terminate them by returning false. When you return true the event continues and editing of the cell or row continues.
The described scenario could be observed here:
In addition, I have prepared small sample illustrating this behavior which could be found here. Please test it on your side and let me know how it behaves.
In addition, what I want to specify is that according to our support policy, we handle only one question per support case/forum thread and not many and differently directed questions. This helps us ensure that all your issues are addressed correctly and please keep this in mind.
Thank you for your cooperation.
Regards,
Georgi Anastasov
Entry Level Software Developer
Infragistics
Also why its only blocking the expirydatevalue and rest field it let me change when the if condition if satified?It shouldnt let you edit complete row?but its not working like that? And could you explain what does return false mean here?that if row editing starts and the if condition if satisfied it will not let you edit the row?
Its working when i m making autoGenerateColumn:true why is that?when its false i m specifying names it should work?