EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: finzaiko on July 18, 2014, 09:45:16 PM



Title: Fire event when click text editor
Post by: finzaiko on July 18, 2014, 09:45:16 PM
How fire event when I click texteditor after I add new row or when I editing the row (double click the row), something like this :

(http://www.indoimage.com/images/20140719/4b0a195f33111ba8f81fa7756091a4be.JPG)
 
Code:
onAdd: function(index, row) { // or onEdit
                var edCode = $(this).datagrid('getEditor', {index: index, field: 'code'});
                var edItemDesc = $(this).datagrid('getEditor', {index: index, field: 'combined'});
                $(edCode.target).attr('disabled', 'disabled');
                $(edItemDesc.target).attr('disabled', 'disabled');
               
                $(edCode.target).click(function(){{
                        alert('show dialog box lookup');
                });
               
            },

I try like this :
Code:
onDblClickCell: function(rowIndex, field, value) {
                if (field === 'code' || field === 'item_desc') {
                    openDlgFindDescItem();
                }
            },

but not work after row editable in edatagrid

Thanks for help highly appreciated.


Title: Re: Fire event when click text editor
Post by: stworthy on July 18, 2014, 11:30:34 PM
When a row is in edit mode, single clicking another row will put that row into edit mode. The editors will be generated immediately and the double click event will be ignored since the second clicking does not applied to the row but editor. To avoid this issue, please call 'saveRow' method to save the editing row before double clicking a row.
Code:
$('#tt').edatagrid({
onDblClickCell:function(index,field){
// ...
},
onClickCell:function(){
$(this).edatagrid('saveRow');
}
});