EasyUI Forum
May 16, 2024, 06:33:22 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: combobox loading other combobox  (Read 19849 times)
danieljbertrand
Newbie
*
Posts: 10


View Profile Email
« on: August 24, 2013, 08:29:05 AM »

Cry I need some help with a jeasyUI form, has a combobox which loads another combobox.

Please email if you are a jeasyUI EXPERT...

danieljamesbertrand at me dot  com

I noticed that my onSelect isn't firing AFTER the first time (I have a console.log message in there that I don't see when I select)

{field:'projectID',
title:'Project/Paid Leave',
width:100,
editor:{
   type:'combobox',
   options:{
      valueField:'id',
      textField:'DescriptionCode',
      data:cmbprojects,
      required:true,
      editable:false,
       onSelect:function(record){
         console.log('select!');
         $('axCode').combobox('reload','remote_combo_data.php?type=projectax&projectID='+record.id);
      }
// closes onSelect
   }
   // closes options
}
// closes editor
}
// closes field
,
{
field:'axCode',
title:'axCode',
width:100,
editor:{
   type:'combobox',
   valueField:'id',
   textField:'Description',
   data:cmbaxcodes,
   required:true,
   editable:false
   }
   // closes editor
,formatter:function(value,row,index){return row.Description;}
// closes formatter
 
}
// closes field
Logged
mephisto
Newbie
*
Posts: 8


View Profile
« Reply #1 on: August 24, 2013, 12:31:07 PM »

You have to use the code in the example of dependent comboboxes you can find here http://www.jeasyui.com/documentation/combobox.php

I'm not an expert so It's preferable you listen other opinions but actually I've problems with the formatter function so I'd remove it in test phase.
I think also you don't need "data:cmbaxcodes," in field "axCode": jquery will fill this combobox with the onSelect function declared.
Logged
danieljbertrand
Newbie
*
Posts: 10


View Profile Email
« Reply #2 on: August 25, 2013, 07:30:20 AM »

Hi,

Thanks for helping.

My main form loads data from a database record , with a master/detail form.

in a new record, I want to click on project (which comes from an external PHP call based on a session variable)..

ON SELECT of this project, I want another external PHP to get JSON based on the selected value.

Code:
{field:'projectID',
title:'Project/Paid Leave',
width:100,
editor:{
type:'combobox',
options:{
valueField:'id',
textField:'DescriptionCode',
data:cmbprojects,
required:true,
editable:false,
       onSelect:function(record){
   console.log('select!');

// this doesn't work, it doesn't load the data.

$('#axCode').combobox('reload','remote_combo_data.php?type=projectax&projectID='+record.id);


// If I do it from a web browser with record.id=, I get:
//
//[{"id":"26","groupID":"1","projectID":"18","Description":"Holiday","isActive":"1"},{"id":"28","groupID":"1","projectID":"18","Description":"Other","isActive":"1"},{"id":"24","groupID":"1","projectID":"18","Description":"Sick Leave","isActive":"1"},{"id":"27","groupID":"1","projectID":"18","Description":"Unpaid Leave","isActive":"1"},{"id":"25","groupID":"1","projectID":"18","Description":"Vacation","isActive":"1"}]

}
// closes onSelect
}
// closes options
}
// closes editor
}
// closes field
,
{
field:'axCode',
title:'axCode',
width:100,
editor:{
type:'combobox',
valueField:'id',
textField:'Description',
required:true,
editable:false
}
// closes editor
,formatter:function(value,row,index){return row.Description;}
// closes formatter
 
}
// closes field
Logged
danieljbertrand
Newbie
*
Posts: 10


View Profile Email
« Reply #3 on: August 25, 2013, 08:04:17 AM »

Something suspicious...

 in Firebug....

TypeError: _3dc is undefined
   
var opts=_3dc.options;


Is it because I have an old version of a jEasyUI js file?
Logged
danieljbertrand
Newbie
*
Posts: 10


View Profile Email
« Reply #4 on: August 25, 2013, 10:26:27 AM »

I think execution is halted every time because of this error....

Logged
danieljbertrand
Newbie
*
Posts: 10


View Profile Email
« Reply #5 on: August 25, 2013, 12:17:27 PM »

These are my css and js includes:

   <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/default/easyui.css">
   <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/icon.css">
   <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/demo/demo.css">
   <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
   <script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>
   <script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.edatagrid.js"></script>
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #6 on: August 28, 2013, 07:04:11 AM »

The editor definition of axCode field is not correct. Try this.
Code:
{
field:'axCode',
editor:{
type:'combobox',
options:{
...
}
}
}
Logged
danieljbertrand
Newbie
*
Posts: 10


View Profile Email
« Reply #7 on: August 28, 2013, 08:03:38 AM »

Thank you for helping.... I am one step further.

I still get the error in firebug:
TypeError: _3f9 is undefined
var opts=_3f9.options;


When I click on project dropdown, it executes this:
        $('#axCode').combobox('reload','remote_combo_data.php?type=projectax&projectID='+record.id);
        alert('remote_combo_data.php?type=projectax&projectID='+record.id);

Which is:
remote_combo_data.php?type=projectax&projectID=18

Which returns:

Code:
[{"id":"26","groupID":"1","projectID":"18","Description":"Holiday","isActive":"1"},{"id":"28","groupID":"1","projectID":"18","Description":"Other","isActive":"1"},{"id":"24","groupID":"1","projectID":"18","Description":"Sick Leave","isActive":"1"},{"id":"27","groupID":"1","projectID":"18","Description":"Unpaid Leave","isActive":"1"},{"id":"25","groupID":"1","projectID":"18","Description":"Vacation","isActive":"1"}]


But there is nothing in the axCode combobox. AND it never says "It should be there!" in an alert box....


This is the code:

Code:
field:'projectID',
title:'Project/Paid Leave',
width:100,
onSelect:function(record){
  var url = 'remote_combo_data.php?type=projectax&projectID='+record.id;
 $('#axCode').combobox('reload', url);
 alert('it should be there!');
},
editor:
{
type:'combobox',
options:{
valueField:'id',
textField:'DescriptionCode',
data:cmbprojects,
required:true,
editable:false
},
}
},
{
field:'axCode',
title:'axCode',
width:100,
editor:{
type:'combobox',
options:{
valueField:'id',
textField:'Description',
required:true,
editable:false
}
}
// closes editor
,formatter:function(value,row,index){return row.Description;}
// closes formatter
}
// closes field
Logged
danieljbertrand
Newbie
*
Posts: 10


View Profile Email
« Reply #8 on: August 28, 2013, 10:09:40 AM »

And I still think the issue is mainly with this:

TypeError: _3f9 is undefined
var opts=_3f9.options;

which is in jquery.easyui.min.js
Logged
varonica
Full Member
***
Posts: 106


View Profile
« Reply #9 on: August 29, 2013, 12:36:33 AM »

What does url say after select ?
Logged
danieljbertrand
Newbie
*
Posts: 10


View Profile Email
« Reply #10 on: September 04, 2013, 12:07:29 PM »

What do you mean?

The url after select is supposed to load JSON based on the select.

the whole page fails with this javascript error when the page loads.

TypeError: _3f9 is undefined
var opts=_3f9.options;

I am still waiting for someone to answer this question for over a week...

stworthy? any answers?

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!