EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: ShockRaver on July 23, 2014, 07:12:09 AM



Title: edatagrid with linkbutton to dialog
Post by: ShockRaver on July 23, 2014, 07:12:09 AM
In my editable datagrid i would like a dialog to pop up when i enter onEdit, or just before a row is updated.

This dialog should contain a textarea and an "ok" button. When OK is clicked and the row in the datagrid is going to update, the text in the textarea should also be posted to the updateUrl.

Maybe dialog isn't the way to go, i don't know.

Anybody any ideas on how to do this?

Eelco


Title: Re: edatagrid with linkbutton to dialog
Post by: stworthy on July 24, 2014, 01:33:30 AM
If you are using the edatagrid plugin, please assign the 'textarea' editor to the field. Thus you will get the inline-editing datagrid and don't need a dialog again when editing a row.


Title: Re: edatagrid with linkbutton to dialog
Post by: ShockRaver on July 24, 2014, 02:08:42 AM
Thx, i am using that now, but it is bound to the width of the column....

Or can i manipulate it?


Title: Re: edatagrid with linkbutton to dialog
Post by: stworthy on July 24, 2014, 06:19:04 AM
Please refer to this example http://jsfiddle.net/7NrQ4/1/


Title: Re: edatagrid with linkbutton to dialog
Post by: ShockRaver on July 25, 2014, 04:21:23 AM
Thx for the input.

I also found another way, here it is:

jquery.easyui.min.js add this:

Code:
$.extend($.fn.datagrid.methods,{
resizeColumn:function(jq,param){
return jq.each(function(){
var dg = $(this);
var col = dg.datagrid('getColumnOption', param.field);
col.boxWidth = param.width + (col.boxWidth-col.width);
col.width = param.width;
dg.datagrid('fixColumnSize', param.field);
})
}
})

Then the onEdit will work with this:

Code:
var ed = $(this).edatagrid('getEditor',{index:index,field:'comment'});
$(this).datagrid('resizeColumn', {
                       field: 'comment',
                      width: 300
});