Show Posts
|
Pages: 1 2 [3] 4 5 6
|
31
|
General Category / EasyUI for jQuery / about form load problem
|
on: February 01, 2015, 10:08:33 PM
|
$.extend($.fn.form.methods, { MyloadData : function(jq, data) { return jq.each(function() { load(this, data); });
function load(target, data) { if (!$.data(target, 'form')) { $.data(target, 'form', { options : $.extend({}, $.fn.form.defaults) }); } var opts = $.data(target, 'form').options;
if (typeof data == 'string') { var param = {}; if (opts.onBeforeLoad.call(target, param) == false) return;
$.ajax({ url : data, data : param, dataType : 'json', success : function(data) { _load(data); }, error : function() { opts.onLoadError.apply(target, arguments); } }); } else { _load(data); } function _load(data) { var form = $(target); var formFields = form.find("input[name],select[name],textarea[name]"); formFields.each(function() { var name = this.name; var value = jQuery.proxy(function() { try { return eval('this.' + name); } catch (e) { return ""; } }, data)(); var rr = _checkField(name, value); if (!rr.length) { var f = form.find("input[numberboxName=\"" + name + "\"]"); if (f.length) { f.numberbox("setValue", value); } else { $("input[name=\"" + name + "\"]", form).val(value); $("textarea[name=\"" + name + "\"]", form).val(value); $("select[name=\"" + name + "\"]", form).val(value); } } _loadCombo(name, value); }); opts.onLoadSuccess.call(target, data); $(target).form("validate"); }
function _checkField(name, val) { var rr = $(target).find('input[name="' + name + '"][type=radio], input[name="' + name + '"][type=checkbox]'); rr._propAttr('checked', false); rr.each(function() { var f = $(this); if (f.val() == String(val) || $.inArray(f.val(), val) >= 0) { f._propAttr('checked', true); } }); return rr; }
function _loadCombo(name, val) { var form = $(target); var cc = [ 'combobox', 'combotree', 'combogrid', 'datetimebox', 'datebox', 'combo' ]; var c = form.find('[comboName="' + name + '"]'); if (c.length) { for (var i = 0; i < cc.length; i++) { var type = cc[i]; if (c.hasClass(type + '-f')) { if (c[type]('options').multiple) { c[type]('setValues', val); } else { c[type]('setValue', val); } return; } } } } } } });
use "MyloadData" method in easyui1.3.6 can be load this Data {dept:{id:'001', name:'us'}} why easyui 1.4.1 ,is't not work?
|
|
|
34
|
General Category / EasyUI for jQuery / Re: form load question
|
on: November 11, 2014, 08:27:18 PM
|
To load the form successfully, the 'user' data must be: var user = {name:'Jion', age:18, nation:'china', 'department.id':0, department:{id:'0', name:'Defense department'}}
Forget it, I continue to use the 1.4 version
|
|
|
35
|
General Category / EasyUI for jQuery / Re: form load question
|
on: November 11, 2014, 08:46:35 AM
|
or <form id="userForm" method="post"> <input name="department.id" class="easyui-combobox" style="width: 379px" data-options="valueField:'id',textField:'name',required:true"> </form>
or
<form id="userForm" method="post"> <input name="department.id" class="easyui-combobox" style="width: 379px" data-options="valueField:'id',textField:'name',required:true"> </form>
|
|
|
36
|
General Category / EasyUI for jQuery / form load question
|
on: November 11, 2014, 08:43:23 AM
|
How to use the form load method to load this data, HTML: ------------------------------------------------------------------------------------------------------------ <form id="userForm" method="post"> <select name="department.id" class="easyui-combotree" style="width: 379px" data-options="url:'${ctx}/SysDepartmentController/list',editable:false,lines: true,valueField:'id',textField:'name',required:true"> </form> ------------------------------------------------------------------------------------------------------------
JSON: ------------------------------------------------------------------------------------------------------------ var user = {name:'Jion', age:18, nation:'china', department:{id:'0', name:'Defense department'}} ------------------------------------------------------------------------------------------------------------
JS: ------------------------------------------------------------------------------------------------------------ $('#userForm').form('load', user); ------------------------------------------------------------------------------------------------------------
|
|
|
42
|
General Category / EasyUI for jQuery / Re: 关于easyUI的datagrid修改某列显示值的问题
|
on: September 04, 2014, 03:17:47 AM
|
Translate:
Hello everyone. I have a problem in the development of today, but I don't know how to modify the value for a column of a row in the not refresh the list of. General effect is this: the mouse to choose a line, the onSelect event fires, sends a request to the server to modify the state, return to modify the status identification success. The front end is modified according to the result of the line (remove the title "[unread]", the font is not bold). The attached pictures illustrate the effect to be achieved.
api datagrid updateRow 试试
|
|
|
|