how to set property's element with webix

Hi,
please i want to know how i can set the property of elements.
Here i want to set the value of select’s options of a select item when another change the value. E.g:

{view:"select", placeholder:"Ville",options:"../adminis/control/ph.extraFile/ville.json", id:"ville", name:"ville", on:{'onChange':'get_grp()'}}. OnChange of this item, i want to change the options of following select:
{view:"select", placeholder:"Groupe", options:"../adminis/control/ph.extraFile/groupe.json", id:"grp", name:"grp"}

knowing that the option change with json file.
Sorry but ii don’t speak very well english so i hope u’ll can help me and that it’s comprehensible.
Thank you

Hi,

if you just want to change a selected option, you can call setValue(value) for the second select.

If you want to change data source, you need to apply define() method $$("grp").define("options", url):

{
   view:"select",
   ... 
   id:"ville", 
   on:{
       'onChange': function(value){
           if($$("grp"))
              $$("grp").define("options","some.php?villeId="+value);
       }
   }
}

hi maria,
Thanks for your answer. i try your code but it doesn’t work.
Here is what i have done
var nomV = $$(‘ville’).getValue();
if($$(“grp”)) $$(“grp”).define(“options”,“control/phmetier/listeGroupe.php?ville=”+nomV);
But when i try there is no one values options.
i want to if i can write that:
$$(“grp”).define(“options”,“data/groupe.json”) knowing that i can generate the json’s file when the select option “ville” change?

Hi,

are you calling define(“options”,url) method from onChange event handler ?

hi maria,
Yes i called define(“option”,url) method from onChange event handler, but not answer. It’s for that i’m asking you if url can be a link from a json’s file?

Hi,

The solution works locally. Please provide a direct link to the demo page if it’s possible.

hi maria,
i’ve found the problem. In fact, in my php’s file, i forgot to post the request’s result that i recove in the option’s select.
So your solution is correct.
Sorry for the trouble.