text: (function(c,d){var b=[];b.push('<div class="f-grid-page" id="{id}">');b.push('<div class="f-grid-page-bg">');b.push('<div style="float:left;">');b.push('<table cellspacing="0" cellpadding="0">');b.push("<tbody>");b.push("<tr>");b.push('<td><span id="{id}-page-first" f_grid_page_status="disabled" f_grid_page_type="first" class="f-grid-page-button  f-grid-page-first-disabled"></span></td>');b.push('<td><span id="{id}-page-prev" f_grid_page_status="disabled" f_grid_page_type="prev" class="f-grid-page-button  f-grid-page-prev-disabled"></span></td>');b.push('<td><span class="f-grid-page-split"></span></td>');b.push('<td><span id="{id}-page-beforeText" class="f-grid-page-content">第</span><input id="{id}-page-input" f_grid_page_type="pageIndex" value="0" class="f-grid-page-input"></td>');b.push('<td style="padding-left:4px;"><span id="{id}-page-afterText" class="grid-page-content">页 共0页</span></td>');b.push('<td><span class="f-grid-page-split"></span></td>');b.push('<td><span id="{id}-page-next" f_grid_page_status="disabled" f_grid_page_type="next" class="f-grid-page-button  f-grid-page-next-disabled"></span></td>');b.push('<td><span id="{id}-page-last" f_grid_page_status="disabled" f_grid_page_type="last" class="f-grid-page-button f-grid-page-last-disabled"></span></td>');b.push('<td><span class="f-grid-page-split"></span></td>');b.push('<td><span id="{id}-page-refresh" f_grid_page_status="enable" f_grid_page_type="refresh" class="f-grid-page-button f-grid-page-btn f-grid-page-refresh"></span></td>');b.push("</tr>");b.push("</tbody>");b.push("</table>");b.push("</div>");b.push('<div style="float:right;">');b.push('<table cellspacing="0" cellpadding="0" border="0">');b.push("<tbody>");b.push("<tr>");b.push('<td><span id="${id}-page-totalcount" class="f-total-count"></span></td>');b.push("</tr>");b.push("</tbody>");b.push("</table>");b.push("</div>");b.push('<div style="clear:both;"></div>');b.push("</div>");b.push("</div>");var a=b.join("");c.widget("FUI.FComboGrid",{options:{readonly:false,enabled:true,disabled:false,selectable:true,filterDelay:300,valueField:"value",displayField:"text",width:150,pageSize:10,listHeight:200,forceSelection:false,listWidth:260,baseParams:{},forceLoad:true,filterField:null,multiSelect:false,dataHandler:"inner"},_create:function(){var f=this.options,h=f.onFilter,e=window["$Utils"];this.isFirstShow=true;f.enabled=!f.disabled;var g=this.element;this.inputEl=g.next();this.imgEl=this.inputEl.next();this.isShow=false;this.value="";if(f.enabled&&f.selectable){this._bindEvent()}},_showList:function(){var e=window["$Utils"];var j=this.listEl;var i=this.inputEl;var k=e.getAlignXY(i,j);var h=k.top;var g=k.left;var f=j.get(0).style;f.left=g+"px";f.top=h+"px";f.width=(this._getListWidth()-2)+"px";f.display="block"},_show:function(f,k,g){var m=this.options,i=window["$Utils"];if(f){c(document).trigger("click.FComboGrid")}if(this.isShow!==true){if(this.isLoading){return}var h=this.isFirstShow;this._prevShowList();this._showList();this._appendEvent();this.isShow=true}if(h||k){m.onBeforesend&&m.onBeforesend();var l=m.filterField||m.valueField;var j=g&&g[l]||"";var e={};if(g&&j){e[l]=j;i.apply(m.baseParams,e);this.listEl.FGrid("setBaseParams",m.baseParams)}else{delete m.baseParams[l];this.listEl.FGrid("setBaseParams",m.baseParams)}this.listEl.FGrid("load",g||{})}},setBaseParams:function(e){if(!e){return}this.options.baseParams=e;this.listEl.FGrid("setBaseParams",e)},hideList:function(){this._hideList()},_prevShowList:function(){var f=this.options;if(this.isFirstShow){var h=[];var p=this.element.attr("id");var o=p+"-combogrid";var q=o+"-combopage";h.push('<div id="');h.push(o);h.push('" class="f-combo-list-container f-grid" style="overflow:hidden; display:none;">');h.push('<div id="'+o+'-grid-head" class="f-grid-head" ></div>');h.push('<div id="'+o+'-grid-body" class="f-grid-body" ></div>');h.push(a.replaceAll("{id}",q));h.push("</div>");c("body").append(h.join(""));this.listEl=$I(o);var u=f.displayField;var e=f.valueField;var y=f.onSelect;delete f.onSelect;var s=function(D,B){var C=D.length;var z="";for(var A=0;A<C;A++){if(A==0){z+=D[B]}else{z+=","+D[B]}}return z};$I(q).FPagingbar({pageSize:f.pageSize});var x=f.onLoadsuccess;delete f.onLoadsuccess;var i=function(D,F,A){var C=$I(o);var E=$I(p);var B=E.val();var z=B&&B.split(",");C.FGrid("selectRowsBydata",z,e);E=null;C=null;x&&x(D,F,A)};var n=f.onLoadfailure;delete f.onLoadfailure;var g=f.onError;delete f.onError;var m=f.baseParams;delete f.baseParams;f.baseParams={};var w=this._getListWidth()-2;var r=f.listHeight;var k=f.dataUrl;var l=f.colModel;delete f.colModel;var v=onRowSelectFn=onRowClickFn=function(){};if(f.multiSelect){onRowSelectFn=function(E,G){var B=$I(p);var F=$I(o);var A=E[u];var D=E[e];var z=B.val();var C=B.next().val();if(C){A=C+","+A}if(z){D=z+","+D}B.val(D);B.next().val(A);B.FComboGrid("setDisplayValue",A);y&&y(E,D,A)};v=function(C,H){var E=$I(p);var F=$I(o);var G=C[u];var J=C[e];var z=E.val();var A=E.next().val();if(A){var L=A.split(",");var B=L.length;var M=[];for(var D=0;D<B;D++){var K=L[D];if(K!==G){M.push(K)}}G=M.join(",")}if(z){var I=z.split(",");var B=I.length;var M=[];for(var D=0;D<B;D++){var K=I[D];if(K!==J){M.push(K)}}J=M.join(",")}E.val(J);E.next().val(G);E.FComboGrid("setDisplayValue",G);y&&y(C,J,G)};var j=function(z){return z[e]+z[u]};this.listEl.FGrid({width:w,height:r,dataUrl:k,selectModel:"multiSelect",crossPageSelect:true,uniqueKey:j,colModel:l,pagingbarId:q,onRowDeselect:v,onRowSelect:onRowSelectFn,autoload:false,onLoadError:g,onLoadfailure:n,onLoadsuccess:i,baseParams:m});c("#"+this.listEl.attr("id")+"-head-table button",this.listEl).css({visibility:"hidden"})}else{onRowClickFn=function(C,D){var A=$I(p);var z=C[u];var B=C[e];A.val(B);A.next().val(z);A.FComboGrid("setDisplayValue",z);A.FComboGrid("hideList");y&&y(C,B,z)};this.listEl.FGrid({width:w,height:r,dataUrl:k,colModel:l,pagingbarId:q,onRowClick:onRowClickFn,autoload:false,onLoadError:g,onLoadfailure:n,onLoadsuccess:i,baseParams:m})}this.isFirstShow=false;var t=this._getEvent("list");this.listEl.bind(t)}},_bindEvent:function(){var f=this._getEvent("img");this.imgEl.bind(f);var g=this._getEvent("input");this.inputEl.bind(g);if(!this.isFirstShow){var e=this._getEvent("list");this.listEl&&this.listEl.bind(e)}},_getEvent:function(o){var f=this,s=f.options,j=this.element,q=this.inputEl,m=window["$Utils"],h=s.multiSeparator,i=document;var g=function(){if(f.isShow){f._hideList()}else{f.inputEl.focus();f._show(true,s.forceLoad);f.inputEl.get(0).select()}};var n={click:function(t){g();m.stopPropagation(t)}};if(o=="img"){return n}var e=function(){if(this.handler){clearTimeout(this.handler)}var t=this.options;var u=this.inputEl.val();var v={};v[t.filterField||t.valueField]=u;this._show(false,true,v);t=null};var l=c.proxy(e,f);var r=function(){if(f.handler){clearTimeout(f.handler)}f.handler=setTimeout(l,f.options.filterDelay)};var k={mousedown:function(t){if(s.forceSelection){g()}},keyup:function(u){var t=u.keyCode;if(c.browser.mozilla&&t!==38&&t!==40&&t!==13&&t!==33&&t!==34){r()}},keydown:function(u){var t=u.keyCode;if(t===38){}else{if(t===40){if(f.isShow){}else{f._show(false,s.forceLoad)}}else{if(t===13){if(f.isShow){}}else{if(t===33){}else{if(t==34){}else{if(t==9){c(i).trigger("click.FComboGrid")}else{if(!s.readonly&&!c.browser.mozilla){r()}}}}}}}m.stopPropagation(u)}};if(o=="input"){return k}var p={click:function(t){f.inputEl.focus();t.stopImmediatePropagation()}};if(o=="list"){return p}},_getListWidth:function(){var h=this.inputEl;var g=this.imgEl;var e=this.options;var j=e.listWidth;if(j&&j<260){e.listWidth=j=260}var i=h.outerWidth()+g.outerWidth();var f=j?j:i;return f},_appendEvent:function(){var h=this,e=window["$Utils"];var f=function(i){e.stopPropagation(i)};var g=function(){h._hideList();h._resetValueOnBlur();h.inputEl.unbind("click.FComboGrid",f);c(document).unbind("click.FComboGrid")};c(document).one("click.FComboGrid",g);h.inputEl.bind("click.FComboGrid",f)},setDisplayValue:function(e){this.displayValue=e},_resetValueOnBlur:function(){var f=this.inputEl.val();if(!f){this.element.val("");this.inputEl.val("")}else{var e=this.displayValue;this.inputEl.val(e)}},_hideList:function(){if(this.isShow===true){this.listEl.hide();this.isShow=false;if(this.options.dataHandler&&this.options.dataHandler!=="inner"){this.reset()}}},destroy:function(){this.inputEl.unbind();if(this.listEl){this.listEl.remove()}this.imgEl.unbind();c(document).unbind("click.FComboGrid");this.inputEl=null;this.listEl=null;this.imgEl=null;c.Widget.prototype.destroy.call(this)},isSelectable:function(){return this.options.selectable},setSelectable:function(f){var h=this,e=window["$Utils"];if(h.options.selectable===f){return}if(true===f){var g=h.inputEl.parent();if(g.length>0){h.inputEl.removeAttr("readonly");h.options.selectable=f;e.removeClass(g.get(0),"f-combo-selectable");h._bindEvent()}}else{if(false===f){var g=h.inputEl.parent();if(g.length>0){h.inputEl.attr("readonly","readonly");h.options.selectable=f;e.addClass(g.get(0),"f-combo-selectable");h._unbindEvent()}}}},isDisabled:function(){return !this.options.enabled},setDisabled:function(g){var e=window["$Utils"],h=this;if(h.options.enabled===!g){return}if(false===g){var f=this.element.parent();if(f.length>0){e.removeClass(f.get(0),"f-combo-disable");h.element.removeAttr("disabled");h.inputEl.removeAttr("disabled");h.options.enabled=true;h._bindEvent()}}else{if(true===g){var f=this.element.parent();if(f.length>0){e.addClass(f.get(0),"f-combo-disable");h.element.attr("disabled","");h.inputEl.attr("disabled","");h.options.enabled=false;h._unbindEvent()}}}},getValue:function(){return this.element.val()},setValue:function(f,e){if(""==f){this.element.val("");this.inputEl.val("")}else{this.element.val(f);if(e){this.inputEl.val(e);this.displayValue=e}else{this.inputEl.val(f);this.displayValue=f}}},reset:function(){this.setValue("")},isReadonly:function(){return this.options.readonly},setReadonly:function(f){var i=this,g=i.options,e=window["$Utils"];if(g.readonly===f){return}if(true==f){var h=i.inputEl.parent();if(h.length>0){g.readonly=f;i.inputEl.attr("readonly","readonly");e.addClass(h.get(0),"f-combo-readonly")}}else{if(false==f){var h=i.inputEl.parent();if(h.length>0){g.readonly=f;i.inputEl.removeAttr("readonly");e.removeClass(h.get(0),"f-combo-readonly")}}}},_unbindEvent:function(){this.imgEl.unbind();this.inputEl.unbind();this.listEl&&this.listEl.unbind();c(document).unbind("click.FCombo")}})})(jQuery);