samedi 5 janvier 2019

How to use multidimensional checkbox v-model in vuejs

Suppose i have some subjects which has conditions and groups. How can i load those first time and check/uncheck in update mood in vuejs?

<div v-for="(sub, Index) in subjects">

  <b> </b>   
    <label v-for="(subconlist) in sub['subCon']">
                                        <input type="checkbox" 
                                        :value="subconlist.id"
                                         :key="subconlist.id"
                                       >
                                        <span>&nbsp;&nbsp;</span>
                                    </label>
                                     <label v-for="clsgrlist in sublist['acGr']">
                                        <input type="checkbox">
                                        <span>&nbsp;&nbsp;</span>
                                    </label>
  </div>
     <button @click="saveOrUpdate()" >Save   </button>
  </div>

fiddle here

the table where i will save it : sub_id,condition_ids,group_ids I have to save data based on checked value in the table with comma separated. How can i get checkbox checked if it already found in the table? I need to get subjectconditon or group ids basis on each subject when click on button.



from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2TwFNCi
via IFTTT

Aucun commentaire:

Enregistrer un commentaire