EasyUI Forum
December 01, 2025, 10:22:39 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: how can do validate editors of edatagrid  (Read 16352 times)
contestant
Newbie
*
Posts: 40


View Profile Email
« 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
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: April 09, 2015, 08:28:54 AM »

Please describe your question in more detail.
Logged
contestant
Newbie
*
Posts: 40


View Profile Email
« Reply #2 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  Smiley
« Last Edit: April 09, 2015, 10:54:48 AM by contestant » Logged
contestant
Newbie
*
Posts: 40


View Profile Email
« Reply #3 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?!  Huh Sad
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #4 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();
    }
});
Logged
contestant
Newbie
*
Posts: 40


View Profile Email
« Reply #5 on: April 10, 2015, 04:19:09 AM »

Thanks agin, But this is not my answer!  Sad

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)
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!