mercredi 2 novembre 2016

How to use set new value to an array object for Emberjs view?

How to use set new value to an array object for Emberjs view? So i have a table of my data then when i click edit button i want to change the class of the parent of that button

So i have this inside my view.


    <tr class="">
        <td>
            <ul class="dropdown-menu pull-right">
                  <li>
                    <a href="#"
                       >
                      Edit
                    </a>
                  </li>
            </ul>
        </td>
    </tr>


This is my controller

tableRowIndex: [],
actions: {
    editLineItem(button,index) {
        console.log(this.get('tableRowIndex'));
        this.set('tableRowIndex[index]','editing-row');
        console.log(this.get('tableRowIndex'));
    },
}

But it didn't work out so

console.log(this.get('tableRowIndex'));

Output the same result before and after i ran

this.set('tableRowIndex[index]','editing-row');

So how can i make this things work out?

Thanks!




Aucun commentaire:

Enregistrer un commentaire