EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: JeroenNL on December 31, 2014, 02:09:14 AM



Title: auto select content of propertygrid row
Post by: JeroenNL on December 31, 2014, 02:09:14 AM
Hi there,

I've got a propertygrid with several rows containing strings and numbers.

1. When I click on a row, I want the current content automatically selected so that it gets overwritten as soon as I start to type.

2. When pressing TAB inside a row of a propertygrid, I'd like the cursor to be moved to the next editable row.

This functionality will make it very easy for users to interact with a propertygrid. Is this possible with propertygrid?

Cheers,
Jeroen


Title: Re: auto select content of propertygrid row
Post by: stworthy on December 31, 2014, 07:47:58 AM
Please try to run the code below:
Code:
$('#pg').propertygrid({
onBeginEdit:function(index,row){
var pg = $(this);
var ed = pg.propertygrid('getEditors',index)[0];
var t = $(ed.target).hasClass('textbox-f') ? $(ed.target).textbox('textbox') : $(ed.target);
t.select();
t.bind('keydown',function(e){
if (e.keyCode == 9){
pg.propertygrid('endEdit', index);
if (index < pg.propertygrid('getRows').length-1){
pg.propertygrid('beginEdit', index+1);
return false;
}
}
})
}
})