In a javascript button I want to check weather a table contains any row.How to do that

Hi all I have a javascript button in a tab where i want to check that a table has any row or not .Note this table is in another tab and and different object(model).How can I do that ?

If memory recalls,

var myTable = $('#my-table').data('object');<br>var tableList = myTable.list;<br>var renderedItems = tableList.renderedItems;<br>$.each(renderedItems, function (i, item) {<br>&nbsp;&nbsp; console.log(i + ' - ' + item);<br>});

Note: if the tab has not been rendered then the table may not be in the DOM.  You will need to look into this.  You can alway query the model, however.

If you have a specific model on the other table you could do something like this:

var tableModel = skuid.$M("ModelForTable"); if(!! { console.log('table contains row'); }