سؤال

I am using the DataTables plugin on multiple pages of my site and when no records are found I need it to display a different message on each page.

Right Now I use the below for the current message:

"oLanguage": {
        "sEmptyTable": "There is no data available for the week selected."
}

Is there some way to maybe put a conditional statement inside of oLanguage that checks for the current page? Something like:

if (currentPage == "thisPage")
    "sEmptyTable" : "There is no data on this current page"
هل كانت مفيدة؟

المحلول

I don't know if this trick works with Datatables, but you could try to pass the "sEmptyTable" as a function:

"oLanguage": {
    "sEmptyTable": function(){ return "There is no data"; }
}

See this fiddle http://jsfiddle.net/tRTkd/ for a demo that sets the text of a button.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top