danieljbertrand
|
|
« on: August 24, 2013, 08:29:05 AM » |
|
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
|
|
« 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.phpI'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
|
|
« 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. {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
|
|
« 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
|
|
« Reply #4 on: August 25, 2013, 10:26:27 AM » |
|
I think execution is halted every time because of this error....
|
|
|
Logged
|
|
|
|
|
stworthy
|
|
« Reply #6 on: August 28, 2013, 07:04:11 AM » |
|
The editor definition of axCode field is not correct. Try this. { field:'axCode', editor:{ type:'combobox', options:{ ... } } }
|
|
|
Logged
|
|
|
|
danieljbertrand
|
|
« 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: [{"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: 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
|
|
« 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
|
|
« Reply #9 on: August 29, 2013, 12:36:33 AM » |
|
What does url say after select ?
|
|
|
Logged
|
|
|
|
danieljbertrand
|
|
« 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
|
|
|
|
|