fnDrawCallback: How to display a message on callback?
fnDrawCallback: How to display a message on callback?
mvelasquez
Posts: 17Questions: 0Answers: 0
I'm using server side to load my data, however, BASED on the count of data I'd like to display a message back to the user.
In the sAjaxSource logic I'm able to set ViewState to let me know that I need to display the message, but I don't think this is accessible in the fnDrawCallback function.
I'm attempting to retrieve a hidden field's value in the fnDrawCallback function but the value, after setting it in the ViewState of the sAjaxSource logic, is empty.
here's my code:
[code]"fnDrawCallback": function(value) {
var show = $('#ShowMessage').val(); //accessing hidden field
if (show && show === "true") {
var message = document.createElement('div');
message.innerHTML = '' + $('#RetrievalMessage').val() + ''; //RetrievalMessage is hidden field that holds text of message
$('#vendorItems_wrapper').prepend(message); //place message at top of datatables grid
}
}[/code]
Now again, "ShowMessage" and "RetrievalMessage" are hidden fields tied to ViewState.
I'm setting the ViewState in the sAjaxSource, but it's not being updated once I get into fnDrawCallback.
Is there another way to send this "RetrievalMessage" text through to fnDrawCallback?
Perhaps through the "value" event argument of fnDrawCallback's function?
In the sAjaxSource logic I'm able to set ViewState to let me know that I need to display the message, but I don't think this is accessible in the fnDrawCallback function.
I'm attempting to retrieve a hidden field's value in the fnDrawCallback function but the value, after setting it in the ViewState of the sAjaxSource logic, is empty.
here's my code:
[code]"fnDrawCallback": function(value) {
var show = $('#ShowMessage').val(); //accessing hidden field
if (show && show === "true") {
var message = document.createElement('div');
message.innerHTML = '' + $('#RetrievalMessage').val() + ''; //RetrievalMessage is hidden field that holds text of message
$('#vendorItems_wrapper').prepend(message); //place message at top of datatables grid
}
}[/code]
Now again, "ShowMessage" and "RetrievalMessage" are hidden fields tied to ViewState.
I'm setting the ViewState in the sAjaxSource, but it's not being updated once I get into fnDrawCallback.
Is there another way to send this "RetrievalMessage" text through to fnDrawCallback?
Perhaps through the "value" event argument of fnDrawCallback's function?
This discussion has been closed.
Replies
Thx :)