EasyUI Forum
May 17, 2024, 07:08:59 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Proxy Comboboxes  (Read 7820 times)
devnull
Sr. Member
****
Posts: 431


View Profile
« on: January 26, 2016, 12:48:22 AM »

I have some pages where there are several comboboxes containing exactly the same data, easyu creates a hidden panel for each of these identical combos.

Is it possible to clone or proxy a single combo so that the items panel is only created once ?

I am desperatly tring to reduce the page size and this would really help ?
Logged

-- Licensed User --
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #1 on: January 27, 2016, 07:44:23 AM »

Please try to download the patch from http://www.jeasyui.com/download/downloads/jquery-easyui-1.4.4-patch.zip, call 'cloneFrom' method to clone the combobox components.
Code:
<input id="cc" class="easyui-combobox" ...>
<input id="c1">
<script type="text/javascript">
$(function(){
$('#c1').combobox('cloneFrom', '#cc');
})
</script>
Logged
devnull
Sr. Member
****
Posts: 431


View Profile
« Reply #2 on: December 09, 2016, 03:22:09 AM »

Hi Jarry;

Any suggestions on how I can extend eui so that I can use this inline like this:

Code:
<input id="test1" class="easyui-combobox" data-options="data:[{value:1,text:'one'},{value:2,text:'two'}]">
<input id="test2" class="easyui-combobox" data-options="cloneFrom:'#test1'">
<input id="test3" class="easyui-combobox" data-options="cloneFrom:'#test1'">
<input id="test4" class="easyui-combobox" data-options="cloneFrom:'#test1'">


EDIT
Code:
	$.extend($.fn.combobox.methods, {
cloneFrom: function(jq, from){
return jq.each(function(){
$(this).combo('cloneFrom', from);
$.data(this, 'combobox', $(from).data('combobox'));
$(this).addClass('combobox-f').attr('comboboxName', $(this).attr('textboxName'));
});
},

I just spotted a problem with cloneFrom() - if you select a value in a cloned combo, it selects a record in the source combo and not  itself ??
« Last Edit: December 09, 2016, 03:30:28 AM by devnull » Logged

-- Licensed User --
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #3 on: December 09, 2016, 07:25:00 PM »

Please download the patch from http://www.jeasyui.com/download/downloads/jquery-easyui-1.5-patch.zip
Code:
<input id="test1" class="easyui-combobox" data-options="data:[{value:1,text:'one'},{value:2,text:'two'}]">
<input id="test2">
<input id="test3">
<input id="test4">
<script type="text/javascript">
$(function(){
$('#test2,#test3,#test4').combobox('cloneFrom', '#test1');
})
</script>
Logged
devnull
Sr. Member
****
Posts: 431


View Profile
« Reply #4 on: December 10, 2016, 05:55:52 PM »

Thanks, but I am using 1.4.4 I cannot upgrade to 1.5 as it breaks a lot of my extensions and work-arounds.

I can't find the cloneFrom() function in that download, is it possble to let me have the updated cloneFrom extension ?

Many Thanks
Logged

-- Licensed User --
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #5 on: December 11, 2016, 05:51:43 AM »

Please download the patch from http://www.jeasyui.com/download/downloads/jquery-easyui-1.4.4-patch.zip.
« Last Edit: December 11, 2016, 04:59:52 PM by jarry » Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!