jQuery UI Widgets › Forums › Grid › Call cellsrenderer function in 'rowselect'
Tagged: ajax, cellsrenderer, defaulthtml, grid, jqxgrid, rowselect
This topic contains 3 replies, has 2 voices, and was last updated by Emanuel 11 years, 11 months ago.
-
Author
-
Hi,
I have a problem with cell rendering after click on row.
My use case: I have a table with a state field and a custome cellsrenderer function. If the state is true then cellsrenderer changes the css font-weight for the cell value to bold. This works fine.
Now if the user selects the row an ajax request to the server is made and the server returns a new state. If this state is false then I would like to change all bold cell values of this selected row to a normal font weight.
How can i achieve this?
In the ‘rowselect’ method I only have the row through the event.args but what I need is the defaulthtml.
Any suggestions?
Thanks,
EmanuelHello Emanuel,
How about updating the “state” field in the Ajax call success callback? This will automatically call cellsrenderer and will update the row view to normal font weight if needed.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Hi Dimitar,
thank you. Just updating the row field will call the cellsrenderer?
I tried this:
$("#transactions").on('rowselect', function(event) { setDocumentAsSeen(event.args.row, 'document') }); function setDocumentAsSeen(row, section) { $.ajax({ url : hostUrl + '/qs/setDocumentAsSeen/' + row.ormId + '/' + section }).success(function(msg) { if (msg == "success") { row.seen = true; } }); }Setting the seen field to true does not call the cellsrenderer function. Am I missing something?
Thanks again,
EmanuelOkay, it was missing a call to updatebounddata.
Thus, the correct call is:
$("#transactions").on('rowselect', function(event) { setDocumentAsSeen(event.args.row, 'document'); $(this).jqxGrid('updatebounddata'); }); function setDocumentAsSeen(row, section) { $.ajax({ url : hostUrl + '/qs/setDocumentAsSeen/' + row.ormId + '/' + section }).success(function(msg) { if (msg == "success") { row.seen = true; } }); }Thanks.
-
AuthorPosts
You must be logged in to reply to this topic.