EasyUI Forum
April 19, 2024, 06:25:25 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: datagrid component cell edit mode, how to get the row index  (Read 6684 times)
fengdie
Jr. Member
**
Posts: 87


View Profile Email
« on: January 19, 2019, 02:47:07 AM »

参考:https://www.jeasyui.com/demo-vue/demo.php?cname=datagrid&pitem=cellediting
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 on: January 19, 2019, 07:59:09 AM »

You can get the 'rowIndex' from the 'slot-scope'.
Code:
<GridColumn field="listprice" title="List Price" align="right" :editable="true">
    <template slot="edit" slot-scope="{row,rowIndex}">
        ...
    </template>
</GridColumn>
Logged
fengdie
Jr. Member
**
Posts: 87


View Profile Email
« Reply #2 on: January 19, 2019, 09:52:32 PM »

I want to get the cell row index in the handleRemove function.

Code:

<div class="datagrid-toolbar">
    <table cellspacing="0" cellpadding="0">
        <tbody>
            <tr>
                <td><LinkButton iconCls="icon-add" :plain="true" @click="handleRemove">删除数据</LinkButton></td>
            </tr>
        </tbody>
    </table>
</div>
<DataGrid>.....</DataGrid>

methods: {
    handleRemove() {
        // get cell row index
    }
}
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #3 on: January 21, 2019, 06:08:33 AM »

When begin to edit a cell, the 'editBegin' event fires. You can get the current editing row and column.
Code:
<DataGrid :data="data" :clickToEdit="true" selectionMode="cell" editMode="cell" style="height:250px"
    @editBegin="onEditBegin($event)"
>
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!