EasyUI Forum
May 16, 2024, 02:55:03 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: ComboGrid multiple select by typing value  (Read 17659 times)
acreonte82
Jr. Member
**
Posts: 85



View Profile
« on: January 28, 2014, 06:50:27 AM »

Hello to all,
I've define a combogrid with multiple select
Code:
$('#id_RS_to_search').combogrid({
 panelWidth:500,
 url: 'controller/search_snp.php?protocol=<?php echo $_SESSION['protocol'?>',
 idField:'id_RS',
 textField:'id_RS',
 mode:'remote',
 multiple: true,
 fitColumns:true,
 columns:[[
{field:'ck',checkbox:true},
{field:'id_RS',title:'id_RS',width:250},
{field:'snp_name_lab',title:'snp_name_lab',width:250}
 ]]
});

my question is: when I select one element, how can I continue to select an other one by typing a new value?
For example I want to search one element typing the right name, then after select continue to select other element different from the first (in the same list)

At the moment and in the various example define in the documentation, is not possibile to select multiple item typing directly but only by click on it.

Can someone help me?

Thanks
Logged
acreonte82
Jr. Member
**
Posts: 85



View Profile
« Reply #1 on: January 30, 2014, 03:37:44 AM »


stworthy can you help me?
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #2 on: January 30, 2014, 08:05:39 AM »

This feature is not supported in current version. It has been sent to our developing team.
Logged
acreonte82
Jr. Member
**
Posts: 85



View Profile
« Reply #3 on: January 31, 2014, 01:28:42 AM »

Thanks!!! Really!!
I wait the new feature
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #4 on: February 02, 2014, 08:29:05 AM »

A possible solution to solve this issue is to override the keyHandler options. Please include the code below to the page.
Code:
<script>
$.extend($.fn.combogrid.defaults.keyHandler, {
enter: function(e){
var target = this;
var state = $.data(target, 'combogrid');
var opts = state.options;
var grid = state.grid;
var tr = opts.finder.getTr(grid[0], null, 'highlight');
if (!tr.length){
tr = opts.finder.getTr(grid[0], null, 'selected');
}
if (!tr.length){return}

state.remainText = false;
var index = parseInt(tr.attr('datagrid-row-index'));
if (opts.multiple){
var vv = [];
var ss = grid.datagrid('getSelections');
for(var i=0; i<ss.length; i++){
vv.push(ss[i][opts.idField]);
}
$(target).combogrid('setValues', vv);
} else {
grid.datagrid('selectRow', index);
$(target).combogrid('hidePanel');
}
},
query: function(q, e){
var target = this;
var state = $.data(target, 'combogrid');
var opts = state.options;
var grid = state.grid;
state.remainText = true;

if (opts.multiple && !q){
$(target).combogrid('setValues', []);
} else {
$(target).combogrid('setValues', [q]);
}

if (opts.mode == 'remote'){
grid.datagrid('clearSelections');
grid.datagrid('load', $.extend({}, opts.queryParams, {q:q}));
} else {
if (!q) return;
grid.datagrid('clearSelections');
var rows = grid.datagrid('getRows');
var qq = q.split(opts.separator);
for(var j=0; j<qq.length; j++){
var q = qq[j];
if (!q){continue;}
for(var i=0; i<rows.length; i++){
if (opts.filter.call(target, q, rows[i])){
grid.datagrid('selectRow', i);
}
}
}
}
}
});
</script>
Logged
acreonte82
Jr. Member
**
Posts: 85



View Profile
« Reply #5 on: February 10, 2014, 01:46:28 AM »

I copied it but no difference...
how  can I include the extension?
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #6 on: February 10, 2014, 08:56:10 AM »

Please refer to this example http://jsfiddle.net/Bz9Js/.
Logged
acreonte82
Jr. Member
**
Posts: 85



View Profile
« Reply #7 on: February 19, 2014, 01:24:56 AM »

Thanks! Works!

Maybe can be a great idea to implement this function as standard for jeasyui

What do u think stworthy ?
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #8 on: February 19, 2014, 01:30:14 AM »

Yes, this feature will be improved in next version. This requirement has been posted to our developing team.
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!