EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: dayaners on May 09, 2014, 10:01:38 AM



Title: Row Editing in DataGrid save function
Post by: dayaners on May 09, 2014, 10:01:38 AM
Hello, im starting with easyui and
i would like to save the lines of editable datagrid.
I have this code for Row editing:
 
Code:
var editIndex = undefined;
        function endEditing(){
            if (editIndex == undefined){return true}
            if ($('#tt').datagrid('validateRow', editIndex)){
                var ed = $('#tt').datagrid('getEditor', {index:editIndex,field:'id'});
                var descricao = $(ed.target).combobox('getText');
                $('#tt').datagrid('getRows')[editIndex]['codmat'] = descricao;
                $('#tt').datagrid('endEdit', editIndex);
                editIndex = undefined;
                return true;
            } else {
                return false;
            }
        }
        function onDblClickRow(index){
            if (editIndex != index){
                if (endEditing()){
                    $('#tt').datagrid('selectRow', index)
                            .datagrid('beginEdit', index);
                    editIndex = index;
                } else {
                    $('#tt').datagrid('selectRow', editIndex);
                }
            }
        }

and must pass all the data to the php and db.
Someone can tell me how starts?


Title: Re: Row Editing in DataGrid save function
Post by: stworthy on May 09, 2014, 09:05:07 PM
Using the edatagrid plugin may be more easily. Please refer to this example http://www.jeasyui.com/demo/main/index.php?plugin=Application&theme=default&dir=ltr&pitem=CRUD%20DataGrid.


Title: Re: Row Editing in DataGrid save function
Post by: dayaners on May 12, 2014, 06:04:40 AM
thanks i will try this one