EasyUI Forum
May 02, 2024, 07:10:53 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 add a action button  (Read 9511 times)
dewan
Newbie
*
Posts: 24


View Profile
« on: November 17, 2018, 07:37:55 AM »

Hi
how do i add a action button in datagrid . I would like to add a view action button when user click on it want to load the detail page.

Thank you
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: November 17, 2018, 08:16:08 PM »

Please look at this page https://www.jeasyui.com/tutorial/datagrid/datagrid12.php
Logged
dewan
Newbie
*
Posts: 24


View Profile
« Reply #2 on: November 22, 2018, 04:23:17 AM »

thank you
Logged
officecode
Jr. Member
**
Posts: 69


View Profile Email
« Reply #3 on: December 05, 2018, 05:27:01 AM »


In this example, how do I get the data row of index?
I know that I can use the ‘selectRow‘ method and then ‘getSelected’ to get it. But there is a problem here. If multiple rows have been selected in the datagrid, the ‘getSelected’ method does not necessarily get the row that is needed.

Code:

function getRowIndex(target){
    var tr = $(target).closest('tr.datagrid-row');
    return parseInt(tr.attr('datagrid-row-index'));
}
function editrow(target){
    var index = getRowIndex(target);
    $('#tt').datagrid('beginEdit', index);

   //How to get the data row of this index?
}

Logged
officecode
Jr. Member
**
Posts: 69


View Profile Email
« Reply #4 on: December 05, 2018, 08:29:51 PM »

Looked at the elements carefully and solved:

tr.find('td[field="id"]').text();
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!