EasyUI Forum
May 17, 2024, 05:25:41 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: combogrid + scrollview in edatagrid - how to select values on combogrid datagrid  (Read 18121 times)
Stefan B.
Full Member
***
Posts: 152


Software Architekt


View Profile Email
« on: March 25, 2015, 02:41:49 AM »

We use a datagrid and a combogrid as editor for the servername.
The combogrid has a big data list, so we use the "Datagrid Scroll View" extension inside the combogrid.

When double click on a row to go in the edit mode and oben the combogrid panel,
how can we select the combogrid value on the datagrid view if this is not on the first scrollview page?

See my exsample for more information: http://jsfiddle.net/sbrandt/m2q5sqmj/
Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #1 on: March 26, 2015, 08:23:59 AM »

Please try this updated example http://jsfiddle.net/m2q5sqmj/4/. Be sure to download the patch from http://www.jeasyui.com/download/downloads/jquery-easyui-1.4.2-patch.zip
Logged
Stefan B.
Full Member
***
Posts: 152


Software Architekt


View Profile Email
« Reply #2 on: March 27, 2015, 01:47:09 AM »

Hi jarry, I try the exsample but it is not working. When going into edit mode the combogrid shows "[object Object]"
Nothing is select correct, and if the server on the second page also nothing is select on the second page.  Undecided
« Last Edit: March 27, 2015, 02:00:17 AM by Stefan B. » Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #3 on: March 27, 2015, 02:25:30 AM »

Please refresh your page and try again. The updated js files must be loaded successfully before running this example.
Logged
Stefan B.
Full Member
***
Posts: 152


Software Architekt


View Profile Email
« Reply #4 on: March 27, 2015, 03:49:00 AM »

Thx - now is the cobo value init when going in edit mode.

But my question was also: how to select the correct page whith the selcted server - in exsample "server 21"

"When double click on a row to go in the edit mode and oben the combogrid panel,
how can we select the combogrid value on the datagrid view if this is not on the first scrollview page?"

Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #5 on: March 27, 2015, 07:01:40 PM »

You don't need to change the datagrid page. You just need to call combogrid's 'setValue' method to set its value and displaying text. The 'setValue' method not only accepts a string value but also a 'value-text' object. The 'value-text' object indicates the combogrid to set its internal value and the displaying text.
Code:
$('#dg').edatagrid({
onBeginEdit: function(index,row){
var ed = $(this).datagrid('getEditor', {index:index,field:'server'});
$(ed.target).combogrid('setValue', {value:row.server,text:row.serverName});
}
})

The 'value' and 'text' property names are defined in your combogrid editor.
Code:
editor:{
type:'combogrid',
options:{
    idField:'value',
    textField:'text',
    //...
}
}
« Last Edit: March 27, 2015, 07:08:17 PM by jarry » Logged
Stefan B.
Full Member
***
Posts: 152


Software Architekt


View Profile Email
« Reply #6 on: March 29, 2015, 11:35:07 PM »

OK. Thx for this exsample.

But remember i use the "DataGrid VirtualScrollView" for the combogrid internal datagrid.

How can I automaticly Scroll down to the page with the selected value, to show the selected item on the combogrid datagrid if the user open the combogrid panel?

See the example http://jsfiddle.net/m2q5sqmj/4/.
The Server "Server 21" is not shown first on the datagrid if the combo opens?
« Last Edit: March 30, 2015, 12:47:18 AM by Stefan B. » Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #7 on: March 30, 2015, 06:37:59 AM »

You do not need to scroll the datagrid view, just call 'setValue' method with 'value' and 'text' property values.
Code:
$(ed.target).combogrid('setValue', {
  value:row.server,
  text:row.serverName
});
Logged
Stefan B.
Full Member
***
Posts: 152


Software Architekt


View Profile Email
« Reply #8 on: March 31, 2015, 04:32:28 AM »

I think you do not understand me.

See this exsample: http://jsfiddle.net/poactohm/
Remember again: We use the "DataGrid VirtualScrollView" for the combogrid internal datagrid. See code:

Code:
 ...
 view:scrollview,
 pageSize: 5,
 ...

The setValue method only works without the scrollview!

* double click on the row with servername is "server 21"
* open the combogid to show the internal datagrid
* The Server "server 21" should direct visible on the datagrid, but it is not shown
* Now when you scoll down the 2, 3, and 4 view page is loaded and the server is shown on the page 5! (see the log statements on console)
* But I will open the page 5 with the selected Server when the combogrid panel is shown!!!

Code:
(index):84 onFetch page: 1
(index):88 onShowPanel ...
(index):84 onFetch page: 2
(index):84 onFetch page: 3
(index):84 onFetch page: 4
(index):84 onFetch page: 5
« Last Edit: March 31, 2015, 04:51:10 AM by Stefan B. » Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #9 on: March 31, 2015, 08:39:56 AM »

If you really want to scroll to the special row that the selected value indicated, you have to call 'scrollTo' or 'gotoPage' methods by yourself. Please take a look at the updated example that shows how to achieve this functionality.
http://jsfiddle.net/poactohm/1/
Logged
Stefan B.
Full Member
***
Posts: 152


Software Architekt


View Profile Email
« Reply #10 on: March 31, 2015, 11:36:36 PM »

Great, that's exactly what we were looking for
The reason is, that we have 20.000 Server in the list and the user should see the page with the selected server!

But some notes: If the list is very long, the event 'onShowPanel' comes before the event 'onFetch'. So the rows object is not defined and an error occurs.

Bug: Also i see that the combogrid data url is triggerd 2 times to fetch the remote data! - I test it, this is a bug in the patch file for version 1.4.2! Without the patch file it is called only once.
« Last Edit: April 02, 2015, 12:00:08 AM by Stefan B. » Logged
catpaw
Jr. Member
**
Posts: 85


View Profile Email
« Reply #11 on: May 25, 2015, 09:27:37 AM »

sorry,

Why is the patch?
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!