dimanche 12 mars 2017

load data from database on select box onchange event

Can anyone guide me how to load data from database when i change the value on the select box? i came up with a solution but its not working.

My Component.js

actions:{
 filterStudent(){
   let filterInputValue = this.get('value');
   console.log(filterInputValue);
   let filterAction = this.get('filter');
   console.log(filterAction);
   }
}

My Controller

   actions: 
   {
     filterStudentResults(param) 
     {
       if (param !== '') 
       {
        return this.get('store').query('Students', { studentName: param });
       } 
       else 
       {
         return this.get('store').findAll('Students');
       }
     }
  }

My Component.hbs

<select name="newType" onchange= class="form-control">
      <option value="" disabled selected>Please Select</option>
      
         <option value=""></option>
                     
</select>

Am calling the component in the Specific template as



Am a newbie to EmberJS and appreciate any help. Thanks in Advance :)




Aucun commentaire:

Enregistrer un commentaire