EasyUI Forum
March 28, 2024, 04:55:58 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: Propertygrid  (Read 3563 times)
jega
Full Member
***
Posts: 190


View Profile
« on: April 05, 2018, 03:57:56 AM »

Hi.

Can't see the solution.

Have this propertygrid

<table id="pg" class="easyui-propertygrid" style="width:300px" data-options="
data:[{'ID':'unitaddress','name':'Address','value':'Yes','group':'unit','editor':{'type':'checkbox','options':{'on':'Yes','off':'No'}}}]">
</table>


Saving the propertygrid checkbox state to database. On site ready, if unitAddress is false, the value must be set to "No" and checkbox must be unchecked


Jesper
Logged
jarry
Administrator
Hero Member
*****
Posts: 2260


View Profile Email
« Reply #1 on: April 05, 2018, 08:20:15 AM »

Listen to the 'onEndEdit' event, detect if the checkbox is checked and do more actions according to your requirement.
Code:
$('#pg').propertygrid({
onEndEdit: function(index,row){
if (row.name == 'Address'){
var ed = $(this).propertygrid('getEditors',index)[0];
if ($(ed.target).is(':checked')){
//...
} else {
//...
}
}
}
})
Logged
jega
Full Member
***
Posts: 190


View Profile
« Reply #2 on: April 05, 2018, 11:32:02 AM »

Hi Jarry

Thanks for answer.

BUT. this was not what i was looking for. Or.

What i have is

<table id="pg" class="easyui-propertygrid" style="width:300px" data-options="
data:[{'ID':'unitaddress','name':'Address','value':'Yes','group':'unit','editor':{'type':'checkbox','options':{'on':'Yes','off':'No'}}}]">
</table>


   $( document ).ready(function(){
      if (QueryString.get('designid') != ''){
         getDesignData(QueryString.get('designid'));
      }
      
   });

Function getDesigndata is a call to the MySQL db which returns this json data

{
    "ID": "1",
    "designName": "Testdesign 1",
    "designData": [{
        "unitaddress": "false"
    }],
    "editedBy": "user",
    "editedTimestamp": "05-04-2018 16:30:18"
}

Now i loop through designData (have more than unitaddress) and want to have the propertygrid row, with id=unitaddress, value = "No" and the checkbox be unchecked.

So i want to set the rows value and editors checkbox

Have i explained it good enough ??


Jesper
Logged
jarry
Administrator
Hero Member
*****
Posts: 2260


View Profile Email
« Reply #3 on: April 06, 2018, 06:54:36 AM »

You can call 'updateRow' method to update the special row.
Code:
var index = ...  // find the row index you want to update
pg.propertygrid('updateRow', {
index: index,
row: {
value: 'No'
}
});
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!