185
|
General Category / EasyUI for jQuery / [SOLVED] Append textbox
|
on: June 26, 2017, 05:48:20 AM
|
Hi.
Have a strange problem
Code
$.each(data, function(index, element) { var inputTag = '<input id="roleID_'+element.ID+'" class="easyui-textbox" style="width:200px" >'; $('#addOff').append(inputTag+'<br>'); $('#roleID_'+element.ID).textbox({}) });
This works fine creating textboxes
When i change
$('#roleID_'+element.ID).textbox({})
to
$('#roleID_'+element.ID).textbox({'setText':element.personName});
to set the personname in the textbox, it dosen't work
As a test:
The entire code i use is (The code inside the icon-add handler is just to test that i can do a setText)
When i push the add button, the personName shows correct in the textbox
$('#roleID_'+element.ID).textbox({ 'setText':element.personName, 'label':element.altRoleType, 'labelPosition':'top', 'iconWidth': 22, 'icons': [{ iconCls:'icon-add', handler: function(e){ $(e.data.target).textbox('setText',element.personName)) } },{ iconCls:'icon-remove', handler: function(e){ $(e.data.target).textbox('clear'); } }] });
What is wrong ??
|
|
|
186
|
General Category / EasyUI for jQuery / Re: [SOLVED] Datagrid delete record and reload problem
|
on: May 09, 2017, 11:16:04 PM
|
Weeee.
Solved the problem
Had this code
<table id="dgAddressList" class="easyui-datagrid" title="PersonListe" style="width:auto;height:auto" data-options=" url:'getfromdb.asp?st=personlist&ct=true', rownumbers:false, checkOnSelect:true, method:'get', pagination:true, singleSelect:false, idField:'cpr', toolbar:'#toolbarAddressList'">
With this code, adding/removing a line to database and using $('#dgAddressList').datagrid('reload'); will not show the added record before update whole site, OR if the debugger was on, it worked fine.
Removing "method:'get'" or setting it to post, solved the problem
|
|
|
187
|
General Category / EasyUI for jQuery / datagrid filter - Prompt goes to first position in textbox
|
on: March 27, 2017, 03:35:28 AM
|
Hi Have a strange problem. I was doing some test with datagrid filter, to learn how to work with it. I did the test on my pc with win7, IE11 ver 11.0.12. Everything works fine. When writing text in filter textbox, the cursor stays on last position. After that i wanted to have it on another site, and testet it on a pc with WIN10 and IE 11 ver 11.0.38. On this setup it always set the cursor to first position after filtering. Filtering works fine. When i use chrome on that pc, it works fine, and cursor stays on last position in textbox Have tried to copy everything from win7 pc to win10 pc, but still same error. And i know that http://www.jeasyui.com/demo/main/index.php?plugin=DataGrid&theme=default&dir=ltr&pitem= is working, altså on my win10 pc So why does my own code fail. Included files <link rel="stylesheet" type="text/css" href="easyui/themes/default/easyui.css"> <link rel="stylesheet" type="text/css" href="easyui/themes/icon.css"> <link rel="stylesheet" type="text/css" href="easyui/themes/iconextra.css"> <script type="text/javascript" src="easyui/js/jquery.min.js"></script> <script type="text/javascript" src="easyui/js/jquery.easyui.min.js"></script> <script type="text/javascript" src="easyui/locale/easyui-lang-da.js"></script> <script type="text/javascript" src="easyui/js/datagrid-detailview.js"></script> <script type="text/javascript" src="easyui/datagrid-filter/datagrid-filter.js"></script> <script type="text/javascript" src="js/jquery.qstring.js"></script> <script type="text/javascript" src="js/myscripts.js"></script> Simple code on asp site <table id="dgSystems" title="System registreringer" class="easyui-datagrid" style="padding:10px 10px 10px 10px" data-options=" method:'get', pagination:true, singleSelect:true, idField:'ID'"> <thead> <tr> <th data-options="field:'ID',align:'center'">System ID</th> <th data-options="field:'SYSTEMNAVN',width:350">System navn</th> </tr> </thead> </table> <script type="text/javascript"> $( document ).ready(function(){ }); $(function(){ var dg = $('#dgSystems').datagrid({ url: 'getfromdb.asp?st=systemlist&ct=true', pagination: true, remoteFilter: true }); dg.datagrid('enableFilter'); }); </script> Jesper
|
|
|
190
|
General Category / EasyUI for jQuery / Re: Datagrid delete record and reload problem
|
on: February 14, 2017, 01:14:03 PM
|
Yes i know how to do it. Here my code.
The treegrid is presenting files in a folder.
Mark a row, push delete. asp code deleting the file, and if ok, reload the treegrid
function deleteFile(){ var row = $('#fileBrowser').treegrid('getSelected'); if (row){ $.messager.confirm('Verify','Er du sikker på du vil slette '+row.name+' ?',function(r){ if (r){ $.post('data_files.asp?st=deletefile',{fn:row.path},function(data,status,xhr){ if (data == 'ok'){ $('#fileBrowser').treegrid('reload'); } }); } }); } }
BUT, the row remains in treegrid. When reload site, the treegrid shows the remaining rows, as espected. If the browser settings is "Automatic" load site, it takes the site from cache, and the treegrid reload doesn't Work, but if i change the browser settings to "Always load site", the reload treegrid Works fine.
|
|
|
191
|
General Category / EasyUI for jQuery / Datagrid delete record and reload problem
|
on: February 14, 2017, 03:19:03 AM
|
Hi. I have a datagrid with some records. When i delete a record, and reload it, the record is still in the grid, but deleted from db. close the page and open it Again, the record is not in grid, as espected. I have to set the browser settings to "Always get the site" (default in browser is Automatic), to remove the record from the grid, on reload, after delete. What can i do 
|
|
|
192
|
General Category / EasyUI for jQuery / Re: Combobox onClick/loader
|
on: December 26, 2016, 07:35:39 AM
|
Hi jarry.
Yes the r.ID had to be r.id, BUT thats not the main problem
When i add the script
$('#unitSearch').combobox({ onClick: function(r){ //console.log(r) findNode(r.id); } });
The loader is never called, and then it never calls getfromdb.asp.
|
|
|
193
|
General Category / EasyUI for jQuery / Combobox onClick/loader
|
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
|
|
|
|