EasyUI Forum
May 07, 2024, 08:51:55 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: edatagrid - bug with onBeforeSave and autoSave [fixed]  (Read 11989 times)
Stefan B.
Full Member
***
Posts: 152


Software Architekt


View Profile Email
« on: February 11, 2015, 03:57:46 AM »

We use a table with autoSafe:true and valide something in the event methode onBeforeSave

Code:
ddv.edatagrid({
pagination: true,
singleSelect:true,
autoSave: true,
columns:[[
{fields ...}
]],
onBeforeSave: function(index) {
//check special flags
if(!handleCheckMigrationSuccessfulAndFallbackFlags($(this), index)) {
return false;
}
return true;
}
...
});

The autosave works fine if the result of onBeforeSave is true.

But after the first time onBeforeSave returns false
and changing the row fields so that  onBeforeSave return true
the autosave is not working any more.

What can be here the problem?
« Last Edit: February 25, 2015, 01:57:41 AM by Stefan B. » Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 on: February 11, 2015, 04:29:54 PM »

What does you function 'handleCheckMigrationSuccessfulAndFallbackFlags' do? Please provide an example to demonstrate your issue.
Logged
Stefan B.
Full Member
***
Posts: 152


Software Architekt


View Profile Email
« Reply #2 on: February 11, 2015, 11:36:32 PM »

The method checks something and only return true or false.

We tests something. And the event onBeforeSave is only trigger one time
when autoSave is true and click outside the datagrid!
« Last Edit: February 11, 2015, 11:38:52 PM by Stefan B. » Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #3 on: February 12, 2015, 09:04:00 AM »

Please refer to this example https://jsfiddle.net/y0obkqaa/. If your issue continues, try to download the updated edatagrid plugin from http://www.jeasyui.com/extension/edatagrid.php
Logged
Stefan B.
Full Member
***
Posts: 152


Software Architekt


View Profile Email
« Reply #4 on: February 19, 2015, 02:51:30 AM »

Hi. I try your exsample. Your exsample code is not working why you use a wrong JQuery version.
I copy the code to my new exsample:
http://jsfiddle.net/sbrandt/0hk1twng/

Whi the new jquery.edatagrid.js it is now working!

But now we have a bigger problem when one alert message should shown in the else block!
Then we have a loop on the event and the application hangs!

Code:
        onBeforeSave: function(index){
            var ed = $(this).edatagrid('getEditor',{index:index,field:'f4'});
            if ((ed.target).is(':checked')){
                //use the alert and the onBeforeSave event is called in a loop when autoSave is active!!!
                //$.messager.alert('error', 'message cannot save why ....' , "warning");
                return false;
            }
        }  

How can we now sho an alert message here?
« Last Edit: March 25, 2015, 01:23:00 AM by Stefan B. » Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #5 on: February 19, 2015, 06:41:39 AM »

Please refer to this example http://jsfiddle.net/0hk1twng/4/. If your issue continues, please try to download the newest 'jquery.edatagrid.js' file from http://www.jeasyui.com/extension/edatagrid.php.
Logged
Stefan B.
Full Member
***
Posts: 152


Software Architekt


View Profile Email
« Reply #6 on: February 20, 2015, 05:21:39 AM »

With the extension update is the bug now fixed  Cheesy
THX for the support
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!