taitai09
|
 |
« on: June 03, 2020, 11:27:02 PM » |
|
An error occurs when using the function setValue in the combotree.
SetValue was used to select specific information from onLoadSuccess events. Please check if it's the wrong usage!
- The following error syntax is applicable.
TypeError: Cannot read property 'options' of undefined at options (jquery.easyui.min.js:7887) at s.fn.init.$.fn.textbox (jquery.easyui.min.js:7856) at options (jquery.easyui.min.js:14881) at s.fn.init.$.fn.combo (jquery.easyui.min.js:14855) at options (jquery.easyui.min.js:15720) at s.fn.init.$.fn.combotree (jquery.easyui.min.js:15703) at HTMLUListElement.<anonymous> (jquery.easyui.min.js:15746) at Function.each (jquery.3.4.1.js:367) at s.fn.init.each (jquery.3.4.1.js:202) at setValues (jquery.easyui.min.js:15745)
TypeError: Cannot read property 'options' of undefined at options (jquery.easyui.all.js:10258) at s.fn.init.$.fn.textbox (jquery.easyui.all.js:10220) at options (jquery.easyui.all.js:18932) at s.fn.init.$.fn.combo (jquery.easyui.all.js:18899) at options (jquery.easyui.all.js:20005) at s.fn.init.$.fn.combotree (jquery.easyui.all.js:19982) at HTMLUListElement.<anonymous> (jquery.easyui.all.js:20043) at Function.each (jquery.3.4.1.js:367) at s.fn.init.each (jquery.3.4.1.js:202) at setValues (jquery.easyui.all.js:20042)
- The following is the relevant code.
$('#wrkjob_cd_top_level').combotree({ url:workjobComboTreeUrl, method:"get", // valueField:'id', // textField:'text', id: 'id', text: 'text', onLoadError: function(){ parent.$.messager.alert('','...'); return false; }, onLoadSuccess: function(node, data){ if($('#_isHandOff').val() == 'Y') { try { console.log(data); for(let dataIndex = 0; dataIndex < data.length; dataIndex++) { let id = data[dataIndex].id; let text = data[dataIndex].text; if($('#_wrkjob_cd').val() == id) { alert("id:" + id + ", text:" + text); $(this).combotree('setValue', {id: id, text: text}); // $(this).combotree('setValue', $('#_wrkjob_cd').val()); // It's Error
} } } catch(error) { console.log(error); } } } }); ///// End of Code
Addition 1. but, the onLoadSuccess function calls to another function, and the setValue from there performs normal operation.
I want to know if it works differently from combobox.
- code function workjobComboTree(isTopLevel) { ... $('#wrkjob_cd_top_level').combotree({ url:workjobComboTreeUrl, method:"get", // valueField:'id', // textField:'text', id: 'id', text: 'text', onLoadError: function(){ parent.$.messager.alert('','...'); return false; }, onLoadSuccess: function(node, data){ combotreeSetValue(); } }); }
function combotreeSetValue() { $('#wrkjob_cd_top_level').combotree('setValue', $('#_wrkjob_cd').val()); }
Addition.2 Of the properties of the combotree (valueField, textField) information, (id, text)Should it be changed to information?
|