jeudi 21 septembre 2017

Get table attribute or property value within ember controller

I have an ember application which has a table and a grid component within a page. I have enabled drag and drop feature which drags a value from a particular cell of a table and drops it into the empty space of the grid. As the tables have more than one column, I want to get the index position or I want to know which column's cell is being dragged. I want that index value of column within the controller.

Suppose a table has 3 rows with 3 columns. For all the elements within the first column being dragged, I want to get the index value as 1 similarly for 2nd and 3rd column.

Here is my .hbs code for the table

<table class = "table table-bordered">
        <thead>
            <tr>
                <th colspan="6">Inbound Units</th>
            </tr>
        </thead>
        <tbody>
          
               <tr>
                
                      
                        <td abbr="P1"></td>
                        <td></td>
                        <td></td>
                        <td></td>
                      
                      
                            </tr>
            
        </tbody>
    </table>

As you can see wihtin the table td tag, I have specified abbr attribute. But I have no idea how to get the value of abbr within the controller. Any other way of getting this is also fine.

Thanks !




Aucun commentaire:

Enregistrer un commentaire