Page 2 of 2

Select component

Posted: Tue Nov 18, 2014 10:00 am
by M&M

hi,

Okie. I was surprised at the result cos my mapping updates a Select component with 7 items. But I found that this statement returns 8

alert(options.length.toString());

Strange but true :)
Anyway thanks...I am iterating through the items and only picking up values that have the id and text. Just my way of confirming that there are no invalid values :)

Thanks & Cheers,
M&M


Select component

Posted: Tue Nov 18, 2014 4:45 pm
by M&M

hi,

I think I was correct in saying that even though there are say 6 items in the Select component, when you iterate it will give you 6 + 1

This code of yours will also do the same ")
var values = [];
var options = Appery("mobileselectmenu_12").find("option");
for(var i = 0; i < options.length; i++){
var option = jQuery(options);
values.push({value: option.val(), view: option.text()});
}
//show array in the browser console
console.log(values);

Thanks,
M&M


Select component

Posted: Tue Nov 18, 2014 5:12 pm
by M&M

anyways i sorted it out.

thanks
MnM