EasyUI Forum
April 29, 2024, 04:27:27 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: [SOLVED] edatagrid destroyRow and reload  (Read 1014 times)
jega
Full Member
***
Posts: 190


View Profile
« on: March 23, 2023, 03:44:11 AM »

Hi.

Have problems with edatagrid

When hit button to destroyRow, it calls the url in destroyUrl and it deletes from db. But, it never removes it from the grid.

I can just remove the destroyUrl method and then it removes it from the grid, but then it cant call the db.

Then i thought i could just reload the grid after destroy the record, but it never get into onDestroy.


<a id="removeButton" href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" onclick="$('#dgLimitList').edatagrid('destroyRow')">Fjern</a>

         $('#dgLimitList').edatagrid({
            url: 'getfromdb.asp?st=limitlist&dataident='+row.dataIdent,
            onDestroy: function(index,row){
               console.log('test');
            },
            destroyMsg:{
               norecord:{
                  title:'Bemærk',
                  msg:'Ingen række valgt.'
               },
               confirm:{
                  title:'Bekræft',
                  msg:'Er du sikker på den skal slettes?'
               }
            },
              autoSave: true,
             saveUrl: 'data_limitlist.asp?st=insert&dataident='+row.dataIdent,
             updateUrl: 'data_limitlist.asp?st=update',
             destroyUrl: 'data_limitlist.asp?st=delete'
         });


Any help

Regards Jesper
« Last Edit: March 27, 2023, 02:45:27 AM by jega » Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 on: March 26, 2023, 07:05:02 PM »

Please look at this example https://www.jeasyui.com/demo/main/index.php?plugin=Application&theme=material-teal&dir=ltr&pitem=CRUD%20DataGrid&sort=asc. The 'destroyRow' method works fine.
Logged
jega
Full Member
***
Posts: 190


View Profile
« Reply #2 on: March 27, 2023, 02:45:03 AM »

Hi jarry

Yes i see. My code is the same, but not working.

After invistigating i found that you send an json response success:true back.

So when i call my file in destroyUrl it must respond with

response.write "{" & chr(34) & "success" & chr(34) & ":" & chr(34) & "true" & chr(34) & "}"

Then it works
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!