EasyUI Forum
May 17, 2024, 12:45:53 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: Propertygrid with Combotree - multiselect with key/values  (Read 13131 times)
chkaufmann
Newbie
*
Posts: 15


View Profile Email
« on: February 11, 2014, 09:44:43 AM »

In a propertygrid I want to create a combotree control with multiselect values.
The items are all defined with id/name (http://www.geologix.ch/downloads/testdata.json). On my server I only save the selected values, e.g. "1,22,4". As display value I would like to show the names ("First, Second Child, Third").

What is the correct approach to implement this in a general way? Where do I have to add the functionality?

cu Christian
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: February 11, 2014, 08:31:01 PM »

You will have to extend or override the combotree editor to support multiple editing. The simplest way is to download the updated datagrid plugin from http://www.jeasyui.com/easyui/plugins/jquery.datagrid.js and include it to the page.
Code:
<script type="text/javascript" src="../../jquery.min.js"></script>
<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
<script type="text/javascript" src="http://www.jeasyui.com/easyui/plugins/jquery.datagrid.js"></script>
<script type="text/javascript" src="../../plugins/jquery.propertygrid.js"></script>

For more information please refer to this example http://jsfiddle.net/fup75/.
Logged
chkaufmann
Newbie
*
Posts: 15


View Profile Email
« Reply #2 on: February 11, 2014, 11:14:40 PM »

For more information please refer to this example http://jsfiddle.net/fup75/.

After done editing there are two things that don't work
- only one item is showed as selected
- the id and not the text is displayed after editing

cu Christian
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 on: February 12, 2014, 12:19:05 AM »

The tree nodes must have 'id' and 'text' properties, otherwise you have to use 'loadFilter' function to convert to standard node data.
Code:
{"name":"ComboTree","group":"Marketing Settings","editor":{
"type":"combotree",
"options":{
url: ...,
multiple:true,
loadFilter:function(data,parent){
var toDo = [];
for(var i=0; i<data.length; i++){
toDo.push(data[i]);
}
while(toDo.length){
var node = toDo.shift();
node.text = node.name;
if (node.children){
toDo = toDo.concat(node.children);
}
}
return data;
}
}
}},
Logged
chkaufmann
Newbie
*
Posts: 15


View Profile Email
« Reply #4 on: February 12, 2014, 02:00:38 AM »

But your JSFiddle example doesn't work

- click on ComboTree; Tree apears -> ok
- Select "Second" and "Third" -> ok
- click somewhere else do close the tree -> NOT ok:
  * id displayed instead of text
  * only one item stays selected

cu Christian
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #5 on: February 12, 2014, 06:11:31 AM »

Please refer to the attached example, it works well. If the issue continues, please try to clear your browser's cache and try it again.
Logged
chkaufmann
Newbie
*
Posts: 15


View Profile Email
« Reply #6 on: February 17, 2014, 06:29:34 AM »

Please refer to the attached example, it works well. If the issue continues, please try to clear your browser's cache and try it again.

The attached example solved the multi select problem (http://www.jeasyui.com/easyui/jquery.easyui.min.js). But in this version of EasyUI, button icons are not placed correctly. Is it possible to get an updated version?

cu Christian
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #7 on: February 17, 2014, 08:58:47 AM »

If you include the easyui file from site, please also include the corresponding theme file from http://www.jeasyui.com/easyui/themes/default/easyui.css
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!