Showing string when data is null

 suppose YY table has no data now.so in the interface its showing nothing. but here i want to show "there is no data right now" string.how can i do this?

Thought I'd add working code including the change from Nicolas. You can add it as many times as you like and point each to specific views :

$(document).on('knack-view-render.view_490', function (event, view, data) {

     

    // Target the 'No Data' string and replace with your own text

 

    $('#view_490 td.kn-td-nodata').text('No Active Invoices');

 

})

$(document).on('knack-view-render.view_515', function (event, view, data) {

     

    // Target the 'No Data' string and replace with your own text

 

    $('#view_515 td.kn-td-nodata').text('No Active Quotes');

 

})

$(document).on('knack-view-render.view_160', function (event, view, data) {

     

    // Target the 'No Data' string and replace with your own text

 

    $('#view_160 td.kn-td-nodata').text('No Notes');

 

})

Hope this helps someone. :)

Hey John,

You'll want to target the specific table in the selector:

$('#view_1 td.kn-td-nodata').text('No Data Available');

Hey Nic,

I'm using your code and it works great, but it changes the text for every table on a page. Is there a way to target a specific table? I even tried updating the view_ID to no avail, it still updates the text for every table on a page.

Thanks for your help man. please check my code block:

$(document).on(‘knack-view-render.view_1’, function (event, view, data) {
var obj = JSON.stringify(data);
if(obj=="")
 print some thing

 })

whenver null is returned i always gettting . so that i bound to code like this.is there any other option?

I made some modifications to the snippet for you. This will target a specific view you specify. Change view_1 to the specific view ID for your page where you're trying to change this.

You can learn more about this here:

http://helpdesk.knackhq.com/solution/categories/5000053588/folders/5000106828/articles/5000447139-customization-with-jquery-and-javascript

or can u plz explain the code ? or any document link is thr?

 

 yes. i am talking about this one, but its generic . i want to change it for one table.

Hi Eli,

Are you talking about modifying the "No Data" string that is already there? Using some jQuery, you could replace that string for all your views:

  

// You need to change view_1 to match the view you want to change this for.

$(document).on(‘knack-view-render.view_1’, function (event, view, data) {

// Target the 'No Data' string and replace with your own text

$('td.kn-td-nodata').text('No Data Available');

})