166
|
General Category / EasyUI for jQuery / numberbox editor in grid, limitations?
|
on: March 24, 2015, 02:44:42 PM
|
trying to add some "friendliness" to a grid, where when clicking a row the clicked cell gets focus, and also when pressing enter it ends editing. code excerpt below. This works for editor type=text, but does not for numberbox. the box does not get focus, and keydown event does not register at all, no output on console for any key press on numberboxs. is there a work around? $("#data").datagrid({ onBeginEdit: function(rowIndex, rowData) { $.each($('#data').datagrid('getEditors', rowIndex), function(i, o) { $(o.target).on('keydown', function(e){ console.log(e.keyCode); switch(e.keyCode) { case 13: // $('#data').datagrid('endEdit', rowIndex); } }); }); }, onClickCell: function(i,f,v) { setTimeout(function() { $($('#data').datagrid('getEditor', {index:i,field:f}).target).focus(); }, 100); } });
|
|
|
167
|
General Category / EasyUI for jQuery / raw source and all patches?
|
on: March 03, 2015, 01:05:54 PM
|
I don't see this on the download page. is there a page or code repo where all the patch files are kept, and the pre-minified source files? there's some things I'd like to extend or override and it's very difficult to do with the minified code.
|
|
|
168
|
General Category / General Discussion / Messager password prompt and login screen
|
on: December 16, 2014, 08:54:18 AM
|
This code adds a password prompt and a simple login form to the Messager. the Password works just like the Prompt method just using a masked input instead of a normal one. the login method is also similar, but the callback takes 2 parameters instead of 1. //add a password prompt to the messenger (function($){ function createWindow(title,content,buttons){ var win=$("<div class=\"messager-body\"></div>").appendTo("body"); win.append(content); if(buttons){ var tb=$("<div class=\"messager-button\"></div>").appendTo(win); for(var btn in buttons){ $("<a></a>").attr("href","javascript:void(0)").text(btn).css("margin-left",10).bind("click",eval(buttons[btn])).appendTo(tb).linkbutton(); } } win.window({ title:title, noheader:(title?false:true), width:300, height:"auto", modal:true, collapsible:false, minimizable:false, maximizable:false, resizable:false, onClose:function(){ setTimeout(function(){ win.window("destroy"); },100); } }); win.window("window").addClass("messager-window"); win.children("div.messager-button").children("a:first").focus(); return win; }; $.extend($.messager, { password:function(title,msg,fn){ var content="<div class=\"messager-icon messager-question\"></div>"+"<div>"+msg+"</div>"+"<br/>"+"<div style=\"clear:both;\"/>"+"<div><input class=\"messager-input\" type=\"password\"/></div>"; var buttons={}; buttons[$.messager.defaults.ok]=function(){ win.window("close"); if(fn){ fn($(".messager-input",win).val()); return false; } }; buttons[$.messager.defaults.cancel]=function(){ win.window("close"); if(fn){ fn(); return false; } }; var win=createWindow(title,content,buttons); win.find("input.messager-input").focus(); return win; }, login:function(title,msg,fn){ var content="<div class=\"messager-icon messager-question\"></div>"+"<div>"+msg+"</div>"+"<br/>"+"<div style=\"clear:both;\"/>" +"<div class=\"righttext\">Login ID: <input class=\"messager-id \" type=\"text\"/></div>" +"<div class=\"righttext\">Password: <input class=\"messager-pass\" type=\"password\"/></div>"; var buttons={}; buttons[$.messager.defaults.ok]=function(){ win.window("close"); if(fn){ fn($(".messager-id",win).val(), $(".messager-pass",win).val()); return false; } }; buttons[$.messager.defaults.cancel]=function(){ win.window("close"); if(fn){ fn(); return false; } }; var win=createWindow(title,content,buttons); win.find("input.messager-id").focus(); return win; } }); })(jQuery);
|
|
|
169
|
General Category / Bug Report / Messager prompt focus
|
on: December 16, 2014, 08:50:09 AM
|
In both IE and Chrome the input does not get focus like the code says it should. this is because it's using win.children("input.messager-input").focus(); which only gets direct decedents, and the input is inside a <div>. Changing to win.find("input.messager-input").focus(); works.
|
|
|
170
|
General Category / EasyUI for jQuery / Re: e.preventDefault(); in tree node?
|
on: October 15, 2014, 01:04:59 PM
|
the above code is incomplete. I can only speculate to what your actual issue is. I don't know where they values come from, or even where they are going to. I will say that if you want handle on the onClick, then handle it on that onClick. where you keep the values and get the data from is something that can be done a dozen ways.
|
|
|
177
|
General Category / EasyUI for jQuery / Re: Changing the datagrid url based on input radio selection
|
on: October 14, 2014, 11:59:43 AM
|
right from the docs: $('#dg').datagrid({ url:'file.php', columns:[[ {field:'code',title:'Code',width:100}, {field:'name',title:'Name',width:100}, {field:'price',title:'Price',width:100,align:'right'} ]] });
$('#dg').datagrid('load', { name: 'easyui', address: 'ho' });
|
|
|
180
|
General Category / EasyUI for jQuery / Re: Changing the datagrid url based on input radio selection
|
on: October 14, 2014, 07:58:52 AM
|
first problem is that "this" is not going to be the input, off the top of my head you can get that via $("input[name='letter_type']:selected"), or maybe :checked, but that's just jquery stuff. then, instead of having the params in the url, define the grid like: $('#dg').datagrid({ url: 'lists.php', queryParams: { ltype: 'default' } }); if you don't want a default then make lists.php return an empty set. then you can use the 'load' method to change the queryParams and load the new data
|
|
|
|