EasyUI Forum
April 16, 2024, 10:58:30 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: How to set COMBOGRID to point on first row or any row?  (Read 9168 times)
Jonny
Newbie
*
Posts: 38


View Profile Email
« on: February 07, 2016, 08:46:45 PM »

Dear Sir/Madam,

            In combobox, the initial / default index is first row.
But in combogrid, there is no default first row, So it needed to 'setValue' to pointing the row.....

In fact I like the default index on combobox ( auto point on first row )..
Is there any command to locate row (setvalue) in combogrid by using index number ?
So I can freely set combogrid goes to first row or lastrow or any row..

Please help me if anybody experience on this...
Thank you.

Regards,
JONNY
Logged
jarry
Administrator
Hero Member
*****
Posts: 2260


View Profile Email
« Reply #1 on: February 08, 2016, 05:55:24 AM »

You can set the 'value' property to initialize the selected row in the drop-down datagrid. Please refer to http://www.jeasyui.com/demo/main/index.php?plugin=ComboGrid&theme=default&dir=ltr&pitem=Initialize%20Value%20for%20ComboGrid
Logged
Jonny
Newbie
*
Posts: 38


View Profile Email
« Reply #2 on: February 08, 2016, 07:45:47 AM »

Thank you for responding me, Sir Jarry..

But is there any command or parameter to locate combogrid's value on first row ?

My Combogrid usually read data from mysql's table...
I don't want to detect / read the first data from mysql's table
I simply want to set combogrid pointing the first row without knowing the data container....

Please investigate deeper for me...
Thank you..

Regards,
JONNY

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


View Profile Email
« Reply #3 on: February 08, 2016, 05:28:17 PM »

When loaded data successfully, the 'onLoadSuccess' event fires. By using this event, you can get the first row and then call 'setValue' method to set the combogrid's value. Please try this code:
Code:
var cc = $('#cc');
cc.combogrid({
onLoadSuccess: function(data){
if (data.rows.length){
var opts = cc.combogrid('options');
cc.combogrid('setValue', data.rows[0][opts.idField])
}
}
})
Logged
Jonny
Newbie
*
Posts: 38


View Profile Email
« Reply #4 on: February 08, 2016, 08:47:00 PM »

Thank you very very much for the solution Sir...

This is exactly what I am looking for  Cheesy
Now I easily can set combogrid pointing the first row without knowing the data container...

Regards,
JONNY
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!