EasyUI Forum
April 26, 2024, 02:24:46 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: Change component in editable Datagrid  (Read 2690 times)
sky-t
Full Member
***
Posts: 145


View Profile
« on: January 27, 2020, 04:45:12 AM »

Hi there,

i have an  editable datagrid with 3 cells. First and second is combobox. The third one is by default a textbox. It works fine so far.
Now i want to change in the third cell the component to tree or treegrid or whatever i want to use depending on the second cell (combobox value). How can i do that?

Thanks very much
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 on: January 28, 2020, 02:32:49 AM »

Please listen to the 'onBeforeEdit' event, change the 'editor' property value conditionally.
Code:
$('#dg').datagrid({
onBeforeEdit: function(index,row){
var col = $(this).datagrid('getColumnOption', 'attr1');
col.editor = {
type:'textbox',
options:{

}
}
}
})
Logged
sky-t
Full Member
***
Posts: 145


View Profile
« Reply #2 on: January 28, 2020, 03:18:33 AM »

hi jarry,

thank you very much for your reply.
is onBeforeEdit just working as ment on before?
I need to change the editor of the third cell depending while editing the second cell combobox value.


Thanks again
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!