Search Support
-
Martin LorenzApril 5, 2017 at 1:15 am #4092
Hello,
I would like to ask, How I can at the same time, add item to table and set visible in this element? I created this metkod:this.addElement = function(){ thisView = this; var dataBinding = this.context.binding.get("value").get("tableItem"); var table = thisView.ui.get('Table1'); if(dataBinding.items.length <= 0){ table.appendElement({}); table.appendElement({}); var length = table.getRecordCount(); console.log(length); //in console I have result 2 and is good var sumLastRow = view.ui.get('Table1/coach_view1/sum[' + length - 1 + ']'); console.log(sumLastRow); //in console I have result 'undefined' sumLastRow.setVisible(false); //in console I have error" Cannot read property 'setVisible' of undefined }
But when I will devide this method for two methods:
this.addElement = function(){ thisView = this; var dataBinding = this.context.binding.get("value").get("tableItem"); var table = thisView.ui.get('Table1'); if(dataBinding.items.length <= 0){ table.appendElement({}); table.appendElement({}); }
this.setVisible= function(){ var length = table.getRecordCount(); console.log(length); var sumLastRow = view.ui.get('Table1/coach_view1/sum[' + length - 1 + ']'); console.log(sumLastRow); sumLastRow.setVisible(false); }
And press button1, calls addElement() method and press button1, calls setVisible(), everything work. Where do I make mistake? I need to add item and set visible at the same time. Please help.
SPARK SupportApril 5, 2017 at 9:12 am #4097Hi Martin,
What happens when you attempt to run the code line by line from the console?
Can you run this command with page.ui instead of view.ui?
sumLastRow = page.ui.get(“Table1/coach_view1/sum[index]”);
Regards,
Stephen P.
-
|
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.