anon-10
January 10, 2019, 12:08am
1
This thread was migrated from an old forum. It may contain information that are no longer valid. For further assistance, please post a new question or open a support ticket from the Customer Support portal .
Dear Team,
I'm trying to modify enable/disable a flexcontainer inside a segment.
//Does not work var widgetDataMapA = { label1:"Description", flxFilter : {isVisible:"status"} } //Does not work for (i = 0; i < Form1.segA.data.length; i++) { if(Form1.segA.data[i].status){ Form1.segA[i].flxFilter.isVisible = "FALSE"; } }
How can I access the widgets of each row and apply a logic?
Regards,
Hello
I dont see any problem with the code but we cannot answer unless we have the clarity on the following
1) Are you using MVC or free form
2) try to alert this Form1.segA.data Are you getting the data . In MVC it will return a string. From String we cannot get the values.
3) What version of Visualizer you are using
4) if possible share your sample . if everything is correctly used then it may be bug as well.
Hi,
I'm using free form and I can see the data when doing an alert(Form1.segA.data or [i])
The data
var data = [ { "Name": "1_Step", "Description": "Academics", "iconON": "someicon.png", "iconOff": "someicon.png", "status": true }, { "Name": "2_Step", "Description": "Sports", "iconON": "someicon.png", "iconOff": "someicon.png", "status": true }, { "Name": "3_Step", "Description": "Library", "iconON": "someicon.png", "iconOff": "someicon.png", "status": false }, { "Name": "4_Step", "Description": "Reception", "iconON": "someicon.png", "iconOff": "someicon.png", "status": true }, { "Name": "5_Step", "Description": "Kitchen", "iconON": "someicon.png", "iconOff": "someicon.png", "status": false }, { "Name": "6_Step", "Description": "IT", "iconON": "someicon.png", "iconOff": "someicon.png", "status": false } ]
Depending on the status I want the property "isVisible" of a flexcontainer to be true or false.
I have tried with the widgetDataMap and also with a for cycle...
how can I access the rows of a segment directly? and modify the properties of the widgets.
Regards,
Hi @Svwvh Wvtson ,
You can use the following snippet for setting the data.
for(var i=0;i<data.length;i++) { var temp = { "lbl1":data[i]["Name"], "lbl2":data[i]["Description"], "lbl3":data[i]["iconON"], "lbl4":data[i]["iconOff"], "flxToggle":{"isVisible":data[i]["status"]} }; tempTab.push(temp); } //alert("--->"+JSON.stringify(tempTab)); this.view.segData.removeAll(); this.view.segData.setData(tempTab);
Where "data" is an array of values, and "flxToggle" is the flex container for which you want to make true/false.
The above is the sample code use while setting the data.
(Or) You can use the below snippet for changing the visibility on clicking the segment row or on clicking on any widget in the segment..
var row = this.view.segData.selectedRowItems; var rowId = this.view.segData.selectedIndex; if(row[0].flxToggle.isVisible) { row[0].flxToggle.isVisible = false; } else { row[0].flxToggle.isVisible = true; } this.view.segData.setDataAt(row[0],rowId[1]);
Thanks,
As it is non MVC project you can try using formID . Segment in place of this.view in the above code snippet and try
Thank you @Austin MvcLeod and @Audwey Ross ,
This responds to my question!
Regards,