Closed unle70 closed 4 years ago
Hello Udi,
Sorry for the delay in the answer - for some reasons I have missed your questions. I will check the first issue and will let you know ASAP.
As for the second issue - which editing module is used? If inline or cell edit is used you can do reloading the grid. In form edit you can set reloadAfterSubmit to true
Hi Tony, That's OK. I know you're a busy guy :) In my case the reload takes around 20-30 seconds, so it's not possible to perform a reload for every single cell edit. Maybe in a future version you could separate the code for setting attributes and for calculating group summary so that they could have their own function call and you could call them whenever needed.
Thanks, Udi
Hello Udi,
I checked the problem regarding cellattr and it is a bug. I will reopen the issue until the bug is fixed.
Hello Udi, I have try to fix the problem with cellattr event. Can you please check if it is ok for you? Thank you
Hi Tony,
Well, Yes and No. The attributes are indeed refreshed for the edited cell (didn't check other cells in the row). But it created a new bug. After the editing is complete (pressing ENTER) the "beforeSelectRow" and "onSelectRow" events stop triggering for that edited row. They still work fine for other rows. This means you cannot edit a row more than once :(
Thank you
Hello,
Thank you for the feedback I can't reproduce the problem. Can you please prepare small demo which demostrates the problem?
Thank you.
Hi Tony,
OK, I found the issue. Actually it was my code which was preventing clicks on the editable fields (part of my application). The reason my code was making this mistake is because the "cellattr" event parameters are behaving differently on a normal grid creation and after editing:
There's a parameter into the "cellattr" event which is called "rawObject". When the grid is first constructed this parameter holds all the fields of the row. But after the editing is done and the "cellattr" is triggered again, the rawObject only holds the edited fields, the id and an "oper" field. Looks like this is actually the object which is sent to the server upon save.
I'm wondering, is this the way it should be or is it a bug?
Thanks, Udi
It is not a bug, but it is a way the methods work.
By example in inline editing we use setRowData method, where the thing happen. This method does not have a rawObject since this rawObject is not available (this raw object should be xml node when data is xml or json object if data is json) - it is available only when the data is created - to overcome partially the problem we pass the data which is passed as parameter in setRowData - i.e the edited data.
One possible solution is to get the data from the row before to save the new one and merge it with the edited data, but this way we go to catch 22 - we can not get the row data (getRowData) when we are in editing mode - I hope you understand the problem.
The same logic is for setCell when we use cell editing.
One possible solution would be to pass all the needed data from within editing module, but I need to make some investigations.
If you have any idea, please let me know.
Hi Tony,
OK, I see the problem here. I found a workaround which solves my problem. Other users might use this idea too, but I'm not sure if you would like to make it standard and implement it into jqGrid.
What I'm doing is to use the "serializeRowData" event and then I add the original (before edit) rowData into the payload (a JSON encoded object with "originalData" name) that is sent to the server. Then this object becomes available for me inside the "cellattr" event and I can use it for my decisions on the attributes.
Hello Udi,
I see that for inline and form editing the problem can be fixed. In these modules we have all the needed data (editable and not editable cell values) which can be passed to setRowData and hence the cellattr will have all the needed information. The only limitation will be if the datatype is xml - in this case the rawObject will be json object and not xml node. Actually this parameter is not correct put in the method. The correct way is to use the 5 parameter of this event which in all cases is json object.
The cell editing need some extra code to fix this problem.
I will try to fix the problem for inline and formedit today and for the cell editing to the end of week
Udi,
I have fixed the problem (I think). If you have time you can test it and let me know if it is working as expected.
Hi Tony,
I don't see any difference. I still cannot see the other fields in the cellattr. I only see the edited fields.
Can you prepare a example, which demonstrate the problem and post it here or send me a link?
Thank you.
Hi Tony, I will try to prepare something. In the meantime I found another problem with this. I told you about my workaround of adding the original data to the payload going out to the server (using serializeRowData). This was working fine, until I tried to implement the successfunc event. If I implement this event (even if I return [true, ''] as constant), the object I have added with the original row data is no longer being transferred to the cellattr.
Ok. Prepare and describe in detail where you expect this data. Note that all the data is added in setRowData (which executes at end when everything is fine) and not during any events in the editing module.
Hello Udi,
I will close the issue. If you will, please feel free to reopen it.
Hello, I'm facing 2 related issues which are both happening after editing:
I'm wondering if there is any service function which could be called for refreshing those. Updating jqGrid to do this automatically would also be very nice.
Thanks, Udi