EasyUI Forum
September 16, 2025, 04:23:43 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: datagrid inline editing combo selected  (Read 13770 times)
devnull
Sr. Member
****
Posts: 431


View Profile
« on: February 28, 2013, 05:41:43 PM »

Hi;

When using a combobox inline in a datagrid, which has one of the fields set to 'selected':true - it appears to have no effect and this option is not selected when clicking on the datagrid field.

It therefore requires 2 clicks, one to display the un-selected combobox, and a second click to select the record you want.

Can this be changed so that if selected:true is set, as soon as the user clicks on the element the default value is selected ?

We have a large datagrid where the user needs to go through each record and select a status, in 95% of cases this will always be the selected:true option and it would cut the number of clicks they need to make by 50%.

Thanks
Logged

-- Licensed User --
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: March 01, 2013, 02:29:55 AM »

When editing a datagrid row, the editor value(combobox) will be filled with the current row field value. It will ignore the selected row of combobox. To make the selected row of combobox to be the default value of current datagrid row, a possible way is to call 'setValue' method for the combobox in the onLoadSuccess event.
Code:
$('#dg').datagrid({
columns:[[
{field:'productid',width:100,
editor:{
type:'combobox',
options:{
valueField:'productid',
textField:'productname',
url:'../datagrid/products.json',
required:true,
onLoadSuccess:function(rows){
for(var i=0; i<rows.length; i++){
var row = rows[i];
if (row.selected){
$(this).combobox('setValue', row.productid);
return;
}
}
}
}
}
}
]]
});
Logged
devnull
Sr. Member
****
Posts: 431


View Profile
« Reply #2 on: March 01, 2013, 03:06:34 AM »

Thanks, I think that effectively means that the selected option does not work when used in a datagrid.

But could it be changed such that if the field is null, then the selected value will be automatically selected.

The reason is, with a datagrid 100 lines long, it is the difference between 50 click and 100 clicks !

Thanks again for all the support.

Logged

-- Licensed User --
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!