EasyUI Forum

General Category => General Discussion => Topic started by: contestant on April 09, 2015, 02:18:27 AM



Title: how can do validate editors of edatagrid
Post by: contestant on April 09, 2015, 02:18:27 AM
Hello

How can do validate editors of edatagrid typically to hide or show "save" and "cancel" buttons?

Thanks


Title: Re: how can do validate editors of edatagrid
Post by: stworthy on April 09, 2015, 08:28:54 AM
Please describe your question in more detail.


Title: Re: how can do validate editors of edatagrid
Post by: contestant on April 09, 2015, 09:08:39 AM
Hi

I add to toolbar "save" and "cancel" for save or reject datagrid edited rows.

So when you are editing row, the buttons are displayed and after editing them will be hide.

The problem is that when you click on the "save" button to save the toolbars disappear but data will not be sent to remote url.

So, I want to validate the editor validator (such as required field and etc.) and if there are not any error then hide toolbars.

Thanks again  :)


Title: Re: how can do validate editors of edatagrid
Post by: contestant on April 09, 2015, 10:56:12 AM
What append?!
You not see yet my answer or you haven't any reply for my problem?!  ??? :(


Title: Re: how can do validate editors of edatagrid
Post by: stworthy on April 09, 2015, 05:03:59 PM
There are many events that you can use to retrieve the edatagrid's editing state such as 'onEdit','onSave','onSuccess',etc. The code below shows a simple implementation of showing and hiding the 'save' button regarding the editing state.
Code:
$('#dg').edatagrid({
    onSave:function(){
        $('#btnSave').hide();
    },
    onEdit:function(){
        $('#btnSave').show();
    }
});


Title: Re: how can do validate editors of edatagrid
Post by: contestant on April 10, 2015, 04:19:09 AM
Thanks agin, But this is not my answer!  :(

I want to validate editor of datagrid typically (myself), Because I want to hide action button on click event so I cant use events of datagrid such as onAfterEdit and etc.

The current solution is below code:

Code:
$(this).datagrid('validateRow', opts.editIndex)