jQWidgets Forums

jQuery UI Widgets Forums Grid Call cellsrenderer function in 'rowselect'

This topic contains 3 replies, has 2 voices, and was last updated by  Emanuel 11 years, 3 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Call cellsrenderer function in 'rowselect' #49805

    Emanuel
    Participant

    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,
    Emanuel

    Call cellsrenderer function in 'rowselect' #49860

    Dimitar
    Participant

    Hello 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,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    Call cellsrenderer function in 'rowselect' #49863

    Emanuel
    Participant

    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,
    Emanuel

    Call cellsrenderer function in 'rowselect' #49868

    Emanuel
    Participant

    Okay, 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.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.