jega
|
|
« on: December 26, 2016, 05:56:35 AM » |
|
Have a strange problem
Having a combobox
<input id="unitSearch" name="unitSearch" class="easyui-combobox" style="width:300px" data-options=" loader: unitsLoader, mode: 'remote', valueField: 'id', textField: 'name', formatter: formatItem, hasDownArrow: false, iconCls:'icon-search', prompt: 'Indtast søgeord'">
A loader
var unitsLoader = function(param,success,error){ var searchWord = param.q || ''; if (searchWord.length <= 1){return false} $.ajax({ url: 'getfromdb.asp', dataType: 'jsonp', data: { sw: searchWord, st: 'unitsearch', }, success: function(data){ var items = $.map(data, function(item,index){ return { id: item.unitID, name: item.unitName, fv: item.unitFV }; }); success(items); }, error: function(){ error.apply(this, arguments); } }); }
And a formater
function formatItem(row){ var s = '<span style="font-weight:bold">' + row.name + '</span><br/>' + '<span style="color:#888">' + row.fv + '</span>'; return s; }
Then i have this script code
$( document ).ready(function(){ $('#unitSearch').combobox('textbox').keyup(function(e){ //console.log(e.keyCode); if (e.keyCode == 13){ findNode($('#unitSearch').combobox('getValue')); } }); });
Everything working perfect. Show items in combobox depending on searchword. Press enter on an item, it show the node in the tree.
Now i add the following code, because i want to findNode when onClick
$('#unitSearch').combobox({ onClick: function(r){ //console.log(r) findNode(r.ID); } });
Nothing Works now. The loader is not called. So no result to the combobox
Anyone that can explain why ??
regards Jesper
|