Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X
Hi All,
I have mashup#1 which contains a search button to load popup Mashup#2. In Popup, I am showing a grid to display data. After selecting particular rows, service is triggered to save selected rows in an Infotable property of my thing.
On PopUp close event, service#2 is triggered to display data saved in Infotable. Data of infotable I am displaying using a collection widget.
My requirement is on the click of the submit button I need to validate whether user has selected any row or not.
I tried passing Collection Data to service to check Infotable rows length but It didn't work and shows error.
Kindly help.
Regards,
Siddharth
In your service, the infotable can be sent as undefined if there are no selected rows, in which case you need to check for both the length being valid as well as the infotable itself having a value, otherwise your service will crash due to attempting to access a property on an undefined value:
if (infotable && infotable.length) {
...
}
Alternatively, you can perform this check client side using a validator/expression and passing in any field of your data set that you know cannot be undefined for any row (e.g. an identifier of some sort). If it is undefined, it means you don't have any rows in your data set and can take the appropriate action.