EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: sky-t on January 27, 2020, 04:45:12 AM



Title: Change component in editable Datagrid
Post by: sky-t 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


Title: Re: Change component in editable Datagrid
Post by: jarry 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:{

}
}
}
})


Title: Re: Change component in editable Datagrid
Post by: sky-t 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