EasyUI Forum
April 26, 2024, 09:38:38 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: [SOLVED] Disable editing on in onBeforeEdit in Datagrid  (Read 12005 times)
ltpitt
Newbie
*
Posts: 6


View Profile Email
« on: May 06, 2014, 04:18:09 PM »

Hi all!

I would like to disable editing if the user click in a row with a specified value in column.

I tried this but I get an error...
What can solve the problem?

    function onBeforeEdit(rowIndex, rowData) {
        if (rowData.AggiornaInventario == -1 ){
            $.messager.alert('Riga non modificabile','I dati di questo materiale sono gi&agrave registrati in magazzino','error');
            rowIndex.editor = null;
                    } else {
                return true;
                            }
        }
« Last Edit: May 13, 2014, 06:19:21 AM by ltpitt » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: May 06, 2014, 04:55:17 PM »

Please try this:
Code:
function onBeforeEdit(rowIndex, rowData) {
if (rowData.AggiornaInventario == -1 ){
$.messager.alert('Riga non modificabile','I dati di questo materiale sono gi&agrave registrati in magazzino','error');
return false;
} else {
return true;
}
}
Logged
ltpitt
Newbie
*
Posts: 6


View Profile Email
« Reply #2 on: May 07, 2014, 05:30:06 AM »

Hi and thanks for help!

If I try your solution the editing is totally disabled (even in rows where it should work) and I get an error:

"Uncaught TypeError: Cannot read property 'target' of undefined "
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 on: May 07, 2014, 05:38:19 PM »

Please try the attached example. It works fine.
Logged
ltpitt
Newbie
*
Posts: 6


View Profile Email
« Reply #4 on: May 13, 2014, 06:19:02 AM »

Classy!

Thanks a ton Smiley
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!