I am using MVCContrib grid to create my table and I am wondering how to handle the situation when no data is returned and the grid show No Results. Any ideas? Right now it gives me a js error.
Just return an empty array (assuming you are using Ajax source data). If using server-side data, then it's basically the same, although of course iTotalRecords etc need to return 0 as well.
I'm a little confused. That table in and of itself is absolutely fine. There is no reason for it to fine. Are you replacing a current table with that one? Or indicating in some what that there might be more than one column (which is usually the cause of this error). Can you post an example please.
I pass back an empty data array as instructed above, and that works great. But I am using fnInitComplete to do various other things when there *is* data.
How can I know if the aaData array is empty from within an fnInitComplete callback so that I can make it stop doing its other stuff?
Replies
Just return an empty array (assuming you are using Ajax source data). If using server-side data, then it's basically the same, although of course iTotalRecords etc need to return 0 as well.
Allan
Thanks for the response. I am using MVCContrib Grid to build my table so when there is no data the table html is this:
{code]There is no data available.[/code]
Any ideas?
Thanks
Allan
[code]There is no data available.[/code]
Thanks
Allan
I pass back an empty data array as instructed above, and that works great. But I am using fnInitComplete to do various other things when there *is* data.
How can I know if the aaData array is empty from within an fnInitComplete callback so that I can make it stop doing its other stuff?
Thanks!
[code]"sAjaxSource": "../scripts/file.php"[/code]
[code]
this.fnGetData().length === 0
[/code]
inside a callback function to find out if there is data available or not.
Allan
I really like this plugin, by the way. This is a fine piece of programming.