Show Posts
|
Pages: 1 2 [3] 4 5
|
34
|
General Category / EasyUI for jQuery / Re: Radio buttons in Form
|
on: September 04, 2022, 09:08:20 PM
|
Hello, Jarry
Thank you, but I don't use HTML structure to create a form.
I use js code for constructing form elements.
How can I achieve this through javascript?
Can we extend radio button component so that it support multiple radio buttons within one label and with each radio button having its own text?
|
|
|
35
|
General Category / EasyUI for jQuery / Radio buttons in Form
|
on: September 02, 2022, 11:42:30 PM
|
Hello,
How can I achieve this type of radio buttons in form (see the attached image)? There is a label on the left and within this label there are multiple radio buttons each having its own label.
|
|
|
36
|
General Category / EasyUI for jQuery / Programmatically Trigger Textbox Button Click
|
on: September 02, 2022, 01:21:15 PM
|
Hello, How can I programmatically trigger textbox button click on enter key press? My code is as follows, but doesn't seem to work inputEvents: { keypress: function(e) { if (e.originalEvent.charCode == 13) { $(e.data.target).textbox("button").click(); } var target = e.data.target; var tmp = $('<span></span>'); tmp.html(String.fromCharCode(e.which)); var c = tmp.text(); tmp.remove(); if ('0123456789'.indexOf(c) >= 0) { return true; } else { return false; } } },
|
|
|
38
|
General Category / EasyUI for jQuery / Save State of Tabs
|
on: July 09, 2022, 11:58:19 PM
|
Hello,
How can I save all opened tabs with URLs and all data in local storage and recreate them automatically on page reload?
Preferably, the saved data should be updated/created on creating a new tab.
Thanks
|
|
|
39
|
General Category / EasyUI for jQuery / Re: How to use extended method
|
on: June 14, 2022, 08:18:57 AM
|
Hello I am sharing the PHP code for those who may need it <?php
$json = '{"op":"and","children":[{"field":"department","op":"equal","value":"000002"},{"field":"department","op":"equal","value":"000001"},{"field":"department","op":"equal","value":"000002"},{"op":"and","value":"","children":[{"field":"department","op":"equal","value":"000026"},{"op":"and","value":"","children":[{"field":"department","op":"equal","value":"000025"},{"op":"or","value":"","children":[{"field":"department","op":"equal","value":"000025"},{"field":"department","op":"equal","value":"000025"}]}]}]},{"op":"and","value":"","children":[{"field":"department","op":"equal","value":"000026"},{"op":"and","value":"","children":[{"field":"department","op":"equal","value":"000025"},{"op":"or","value":"","children":[{"field":"department","op":"equal","value":"000025"},{"field":"department","op":"equal","value":"000025"}]}]}]}]}';
$json_array = json_decode($json,true);
function oprater($op,$val){ if($op=='equal'){ return " = '$val' "; }elseif($op=='notequal'){ return " != '$val' "; }elseif($op=='less'){ return " < '$val' "; }elseif($op=='lessorequal'){ return " <= '$val' "; }elseif($op=='greater'){ return " > '$val' "; }elseif($op=='greaterorequal'){ return " >= '$val' "; }elseif($op=='beginwith'){ return " LIKE '$val%' "; }elseif($op=='endwith'){ return " LIKE '%$val' "; }elseif($op=='contains'){ return " LIKE '%$val%' "; } }
function qer($arr,$op="",$str=""){
if(array_key_exists('children',$arr)){ $str .= qer($arr['children'],$arr['op']);
}else{
$n = count($arr); $m = 1; foreach($arr AS $val){ if(array_key_exists('children',$val)){ if($n==$m){ $str .= " ( " . qer($val['children'],$val['op']) ." ) "; }else{ $str .= " ( " . qer($val['children'],$val['op']) ." ) " . $op .""; } }else{
if($n==$m){ $str .= " `".$val['field']."` ". oprater($val['op'],$val['value']) ." "; }else{ $str .= " `".$val['field']."` ". oprater($val['op'],$val['value']) ." ". $op ." "; } } $m++; } }
return $str;
} echo "Select * from 'abc' WHERE <br> (". qer($json_array) . " )<br>";
?> Admin, hope it is correct. I have spent hours writing it
|
|
|
40
|
General Category / EasyUI for jQuery / Re: How to use extended method
|
on: June 12, 2022, 10:48:15 AM
|
Hello, 1. How can we pass individual operators for each field? For example: $('#fb').filterbuilder({
fields: [{ field: 'department', title: 'Department', operators: [ [{ op: 'contains', text: 'Contains' }, { op: 'equal', text: 'Equal' },
] ] }, { field: 'position', title: 'Position', operators: [ [{ op: 'greater', text: 'Greater' }, { op: 'equal', text: 'Equal' },
] ] }, { field: 'category', title: 'Category' } ] }) 2. How can we pass "type" and "options" to the field? For example: { field: 'department', title: 'Department', type: 'combobox', trigger: 'none', options: { editable: true, selectOnNavigation: false, url: '/api-getRoles', reversed: true, method: 'get', valueField: 'role_id', textField: 'role_name', limitToList: true, }, operators: [ [{ op: 'contains', text: 'Contains' }, { op: 'equal', text: 'Equal' },
] }, 3. How can we update DataGrid based on the filtered data? (php serverside code example available?) Thanks
|
|
|
41
|
General Category / EasyUI for jQuery / Re: How to use extended method
|
on: June 09, 2022, 12:48:28 PM
|
Thank you very much! I guess it should be slightly modified, as multiple Groups together seems vague (like multiple And conditions one after another - see the screenshot) which produces the following code: {"op":"and","children":[{"field":"department","op":"contains","value":"1"},{"field":"department","op":"contains","value":"4"},{"op":"and","value":"","children":[{"field":"department","op":"contains","value":"55"},{"field":"department","op":"contains","value":""},{"op":"and","value":"","children":[{"op":"and","value":"","children":[{"op":"and","value":"","children":[{"field":"department","op":"contains","value":"5666"}]}]}]}]}]}
|
|
|
43
|
General Category / EasyUI for jQuery / How to use extended method
|
on: June 03, 2022, 10:28:30 AM
|
Hello I have found the Easy UI plugin that extends the datagrid filter functionality. Please, see the code below. I am wondering how to activate this grid filter in my datagrid? /* 2017-5-8 dbaylu hi@dbay.cn */ ( function ($, undefined) { // search:false then the current column does not work $.fn.gridFilter = function ( arg ) { if ( typeof arg === 'string' ) { var fn = $.fn.gridFilter[arg]; if (! fn) { throw ("gridFilter - No such method: " + arg); } varargs = $.makeArray(arguments).slice(1 ); return fn.apply( this ,args); }
var extendedOptions= { gridfilterRules: [] }; $.extend($.fn. datagrid.defaults, extendedOptions);
var p = $.extend( true ,{ name: null , gridid: null , columns:[], single: false ,// Only radio is allowed for TRUE combobox:{width:90,panelHeight:'auto' }, dialog:{ title:'Advanced Search' , dialogid:'dbaysearch' , iconCls: "icon-search" , saveButtonIconCls:"icon-search" , width: 540 , height: 200 , topMost: false , nableCloseButton: false , collapsible:true , resizable: true , modal: false , saveButtonText: "Search" , onSave: function (d){ var ds = d.form("validate" ), iClose = false ; if (ds) {
var va=d.form("getData",{transcript: "jsonarray" }); // Prevent conflict with easyui-filter plugin if ($('#'+p.gridid)[p.name ]('options').enablefilter){ $('#'+p.gridid)[p.name]('resize' ,{filterRules:va}); $('#'+p.gridid)[p.name]( 'resize' ,{gridfilterRules:va}); $('#'+p.gridid)[p.name]('load' ); } else { $('#'+p.gridid)[p .name]('resize' ,{gridfilterRules:va}); $('#'+p.gridid)[p.name]('load' ,{filterRules:JSON.stringify(va)}); }
} return false ; } }, groupOp:[{field:'and',title:'and',selected: true },{field:'or',title:'or' }], op: { combobox:[{value:'equal',text:'equal to ( = )',selected: true },{value:'notequal',text:'not equal to ( <> )' }], datebox:[ {value:'equal',text:'equal (=)',selected: true},{value:'notequal',text:'not equal to( <>)'},{value:'less',text:'less than( < )'},{value:'lessorequal',text:'less than or equal to ( <= )'},{value:'greater',text:'greater than ( > )'},{value:'greaterorequal',text:'greater than or equal ( >= )' }], numberbox:[{value :'equal',text:'equal to ( = )',selected: true },{value:'notequal',text:'not equal to ( <>)'},{value:'less',text:'less than ( < )'},{value:'lessorequal',text:'less than or equal to ( <= )'},{value:'greater',text:'greater than ( > )'},{value:'greaterorequal',text: 'Greater than or equal to ( >= )' }], textbox:[{value:'contains',text:'contains',selected: true },{value:'equal',text:'equal to (=)'},{value:'notequal',text:'not equal to (<>)'},{value:'beginwith',text:'begins with...' },{value:'endwith',text:'Endwith' }], monthbox:[{value:'equal',text:'equal (=)',selected: true },{value:'notequal',text:'not equal (<>)'},{value:'less', text:'less than ( < )'},{value:'lessorequal',text:'less than or equal to ( <= )'},{value:'greater',text:'greater than ( > )'},{value:' greaterorequal',text:'greater than or equal to ( >= )' }] } }, arg || {}); return this .each( function () { // this.p = p; if (p .name === null || p.name === undefined) { p.name=dbay.gridName('#'+ p.gridid); } p.columns=$.array.filter($('#'+p.gridid)[p.name]("getColumns", "all"), function (val) { return val.field && val.title&&val.search != false ? true : false ; }); var i, len = p.columns.length, cl; if ( !len ) { return ;} var table = $("<table class='group' style ='border:0px none;'><tbody></tbody></table>"),tr = $("<tr></tr>" ); this .reDraw = function () { if (p.single){$.messager.alert('Only single search is allowed'); return;} var t = this .createTableRowForRule(p); table.append(t); }; this .createTableRowForRule = function (group,table,parentgroup) { var that= this , tr = $("< tr></tr>"),i, op, trpar, cm, str="" , selected; tr.append("<td class='first'></td>" ); var ruleFieldTd = $ ("<td class='columns'></td>" ); tr.append(ruleFieldTd); varruleFieldSelect = $("<select name='field'></select>" ); ruleFieldTd.append(ruleFieldSelect); var texts=$("<input type=\"hidden\" name=\"text\ "/>" ); var ruleGx = $("<input type=\"hidden\" name=\"alias\"/>" ); ruleFieldTd.append(texts);
var ruleOperatorTd = $(" <td class='operators'></td>" ); tr.append(ruleOperatorTd); var ruleOperatorSelect = $("<select name='op'></select>" ); ruleOperatorTd.append(ruleOperatorSelect)
ruleOperatorSelect.combobox($.extend( true ,p.combobox,{data:group.op.textbox}));
var ruleDataTd = $("<td class='data'> </td>" ); tr.append(ruleDataTd); var ruleFieldvalue=$("<input type=\"text\" class=\"easyui-validatebox\" name=\"value\">" ) ; ruleDataTd.append(ruleFieldvalue); ruleFieldvalue.textbox({width:140,required: true }); var tdruleGx=$("<td></td>"); tr.append(tdruleGx); tdruleGx.append(ruleGx); if (parentgroup !== null ) { var gxSelect = $("<select name='groupop'></select>" ); tdruleGx.append(gxSelect); gxSelect.combobox({width:60,panelHeight:'auto',valueField: "field", textField: "title" , data:group.groupOp}); } else { var gxSelect = $("<input type=\"hidden\" name=\"groupop\"/>"); tdruleGx.append(gxSelect); } var rulebutton = $("<td></td>" ); tr.append(rulebutton); var inputAddRule = $("<input type='button' value= '+' title='Add rule'/>" ) inputAddRule.bind('click', function (){ that.reDraw() }); rulebutton.append(inputAddRule) if (parentgroup !== null ) { //ignore the first group var inputDeleteGroup = $("<input type='button' value='-' title='Delete group'/>" ); rulebutton.append(inputDeleteGroup); inputDeleteGroup.bind('click' , function () { tr.remove(); return false ; }); } ruleFieldSelect.combobox({editable: false ,width:120,panelHeight:'auto',panelMaxHeight:150,required: true,valueField: "field", textField: "title", data:group.columns,onSelect: function (obj){ var type='textbox',option={},alias='' ; if ($.type (obj.hfilter) == "object" ){ type= obj.hfilter.type; option= obj.hfilter.options; alias= obj.hfilter.alias } texts.val(type); ruleGx .val(alias); var name=dbay.textName(ruleFieldvalue); if (type==name&&type=='textbox' ){ ruleFieldvalue[name]($.extend({},option)); return false ; } ruleFieldvalue[name]( "destroy" ); ruleFieldvalue=$("<input type=\"text\" class=\"easyui-validatebox\" name=\"value\">" ); ruleDataTd.append(ruleFieldvalue); switch (type){ case 'datebox':case 'datetimebox': ruleOperatorSelect.combobox('loadData' ,group.op.datebox); ruleFieldvalue[type]($.extend({width:140,required: true ,editable: false ,prompt:'Please select a date'},option )); // Not editable by default break ; case 'monthbox' : ruleOperatorSelect.combobox('loadData' ,group.op.monthbox); ruleFieldvalue.monthbox($.extend({width:140,required: true ,editable: false ,prompt:'Please select the month'},option));// Not editable by default break ; case "combobox" : ruleOperatorSelect.combobox('loadData' ,group.op.combobox); ruleFieldvalue.combobox($.extend({width:140,required: true ,editable: false ,panelHeight:'auto'},option)); // Uneditable by default break ; case "numberbox" : ruleOperatorSelect.combobox('loadData' ,group.op.numberbox); ruleFieldvalue.numberbox($.extend({width:140,required: true ,prompt:'Only numbers can be entered' },option)); break ; case "combotree" : ruleOperatorSelect.combobox('loadData' ,group .op.combobox); ruleFieldvalue.combotree($.extend({width:140,required: true ,editable: false ,panelHeight:'auto'},option)); // default not editable break ; default : ruleOperatorSelect.combobox('loadData' ,group.op.textbox); ruleFieldvalue.textbox($.extend({width:140,required: true },option)); break ; } }}); return tr; }; table.append(tr); var th = $("<th colspan='5'></th>" ); tr.append(th); table.append( this . createTableRowForRule(p,this , null )); var showDialog= $.extend({},p.dialog,{content:table}) $.easyui.showDialog(showDialog);//Open window }) } })( jQuery);
|
|
|
|