Skip to main content
Nintex Community Menu Bar
Question

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

  • July 10, 2024
  • 3 replies
  • 26 views

Forum|alt.badge.img+4

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 ?

3 replies

Forum|alt.badge.img+11

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>});



http://help.skuidify.com/m/11720/l/205336-skuid-ui-list



Forum|alt.badge.img+11

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.


Forum|alt.badge.img+5
  • July 10, 2024

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

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