EasyUI Forum
May 21, 2024, 12:12:11 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: combobox and onBeforeLoad  (Read 9426 times)
rezzonico
Full Member
***
Posts: 184


View Profile
« on: February 14, 2014, 06:47:09 AM »

Hi all,

I have a field with a combobox editor (the field is in a databgird).
I use the onBeforeLoad function in order to populate the content on the combox (the data is read from another datagrid).

Here is the code:
Code:
               {field:'Jptask',title:'Op',width:10,
                   editor: {
                      type: 'combobox',
                      options: {
                         onBeforeLoad:function() {
                            var rows = $('#dg_Jobtask').datagrid('getRows');
                            var json = [];
                            for (var i=0; i<rows.length; i++) {
                               json.push({ id: rows[i].Jptask, text: rows[i].Jptask })
                            }
                            $(this).combobox('loadData', json);
                         }
                      }
                   }
               },

All work as expected.
The only problem is that the onBeforeLoad function is executed only the first time when the user click on the combobox.
Is it possible to execute this function every time when the user click on the combobox ?

Thanks in advance for any help.
Miche
« Last Edit: February 14, 2014, 07:07:04 AM by rezzonico » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: February 14, 2014, 08:27:54 AM »

Please try to use 'onShowPanel' event that is triggered when click to drop down the content panel.
Code:
editor: {
    type: 'combobox',
    options: {
       onShowPanel:function() {
          //...;
       }
    }
}
Logged
rezzonico
Full Member
***
Posts: 184


View Profile
« Reply #2 on: February 14, 2014, 08:59:09 AM »

It works perfectly.
Thanks a lot !

Miche
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!