EasyUI Forum
April 24, 2024, 04:05:55 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
  Home Help Search Login Register  
  Show Posts
Pages: 1 ... 10 11 [12] 13 14 15
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?

Code:
$("#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.
Code:
//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
Code:
win.children("input.messager-input").focus();
which only gets direct decedents, and the input is inside a <div>.  Changing to
Code:
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.
171  General Category / EasyUI for jQuery / Re: e.preventDefault(); in tree node? on: October 15, 2014, 12:37:39 PM
don't put the href to the file, instead have your onlick handle it. 
172  General Category / EasyUI for jQuery / Re: Changing the datagrid url based on input radio selection on: October 15, 2014, 07:11:37 AM
no, it's just a text string.  is this more clear?

Code:
$('#dg').datagrid('load', {
    some_param: 'a value',
    another_param: 'another value'
});
173  General Category / EasyUI for jQuery / Re: edatagrid and post more data when want to save row on: October 15, 2014, 07:09:46 AM
jarry's suggestion does exactly that.
174  General Category / EasyUI for jQuery / Re: e.preventDefault(); in tree node? on: October 15, 2014, 07:09:04 AM
of the <a> is inside the element that the onClick on, the the <a>'s own onlick will complete before that handler. 
175  General Category / EasyUI for jQuery / Re: e.preventDefault(); in tree node? on: October 14, 2014, 12:37:05 PM
the onClick is on what, exactly?
176  General Category / EasyUI for jQuery / Re: Changing the datagrid url based on input radio selection on: October 14, 2014, 12:35:31 PM
in this case the 'load' call sends name and address query parameters to file.php and reloads the grid data.  it's exactly what you asked for.  sub in your values.
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:
Code:
$('#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'
});

178  General Category / EasyUI for jQuery / Re: Changing the datagrid url based on input radio selection on: October 14, 2014, 11:29:43 AM
did you look at the docs on the load method?  you don't need reload at all.  reload fetches updated data using the same parameters.
179  General Category / EasyUI for jQuery / Re: Changing the datagrid url based on input radio selection on: October 14, 2014, 11:15:49 AM
it's in the documentation http://www.jeasyui.com/documentation/index.php# under "Query data with some parameters."

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:

Code:
$('#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
Pages: 1 ... 10 11 [12] 13 14 15
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!