/**
bootsform
*/
(function ($) {
function bootstigger(element, options){
var obj = element;
var can = options;
var rand = can.rand;
var me = this;
//初始化
this.init = function(){
this.mainidss = 'main_'+rand+'';
if(can.namedisplay=='')can.namedisplay=''+can.name+'_text';
var s = '
';
s += ' ';
s += ' ';
s += ' ';
if(can.clearbool){
s += ' ';
}
s += ' ';
s += ' ';
s += '
';
var s1 = '
'+s+'
';
obj.html(s1);
$('#down_'+rand+'').click(function(){
me._down(this);
});
if(can.clearbool){
$('#downclear_'+rand+'').click(function(){
me._downclear(this);
});
}
this.setDefault(can.value, can.data);
this._loadbool = false;
this._fistload(0);//自动加载
};
this._down = function(o1){
var o = $(o1);//
if(!get(this.mainidss)){
var s = '
';
s += '
';
s += '
';
s += '
';
s += '
';
s += '
';
var w = can.width;
if(w==0)w = obj.width()-2;
var s1 = '
';
s1+=s;
s1+='';
s1+='
';
$('#div_'+rand+'').append(s1);
this._showdata(can.data);
js.addbody(rand, 'hide', this.mainidss);
if(!this._loadbool)this._fistload(1);
$('#keysou_'+rand+'').keyup(function(e){
me._soukeysss(this, e);
return false;
});
$('#keysoubtn_'+rand+'').click(function(){
me._soukeybtn(this);
return false;
});
}
$('#'+this.mainidss+'').toggle();
if(get(this.mainidss).style.display!='none'){
get('keysou_'+rand+'').focus();
this._setselcol();
this._showeizhi();
}
};
this._showdata = function(a){
var s = '',i,val1,s1,len = a.length;
this.nowdata = a;
for(i=0; i';
if(can.checked){
s+=' ';
}
s1= can.renderer(a[i], this);
if(!s1){
s+= a[i][can.displayfields];
}else{
s+= s1;
}
s+= '';
}
var o = $('#list_'+rand+'');
o.html(s);
o.find("div.div01").click(function(){
me._itemsclick(this);
});
if(can.checked){
o.find("input[type='checkbox']").click(function(){
me._itemscheckclick(this);
});
}
var h = can.height,h1 = i*can.listheight;
if(h1>h)h1 = h;
o.css('height',''+h1+'px');
this._setselcol();
};
this._showeizhi= function(){
var o,jg,t;
o = $('#'+this.mainidss+'');
jg = $('#div_'+rand+'').offset().top+o.height()-winHb()+10;
t = 33;
if(jg>0)t = 0-jg;
o.css('top',''+t+'px');
};
this._setselcol= function(){
var vals = this.getValue(),i,o1,val1;
var o = $('#list_'+rand+'').find("div[val]");
o.removeClass();
o.addClass('div01');
var o2 = $('#list_'+rand+'').find("input[type='checkbox']");
o2.attr('checked', false);
if(vals!=''){
var a = vals.split(',');
for(i=0; i-1)o1.checked=true;
}
}
};
this._cenghide = function(){
$('#'+this.mainidss+'').hide();
};
this._itemsclick = function(o1){
if(can.checked)return;
var o = $(o1);
var oi = parseInt(o.attr('oi'));
var d = this.nowdata[oi],
nae = d[can.displayfields],
val = d[can.valuefields];
$('#display_'+rand+'').val(nae);
$('#value_'+rand+'').val(val);
$('#display_'+rand+'').focus();
can.itemsclick(d, this, oi);
this._cenghide();
};
this._itemscheckclick = function(o1){
var s = js.getchecked('checkbox_'+rand+'');
var nae='',val='',i,s1,d,oi;
if(s!=''){
s1 = s.split(',');
for(i=0;i-1){
if(!can.checked){
nae = d[can.displayfields];
break;
}else{
if(oi==0)nae='';
nae+=','+d[can.displayfields];
oi++;
}
}
}
if(nae.substr(0,1)==',')nae=nae.substr(1);
$('#display_'+rand+'').val(nae);
$('#value_'+rand+'').val(val);
};
this.getValue = function(){
return $('#value_'+rand+'').val();
};
this.getRawValue = function(){
return $('#display_'+rand+'').val();
};
this.setValue = function(val){
this.setDefault(val, can.data);
};
this.setRawValue = function(v, v1){
$('#display_'+rand+'').val(v);
$('#value_'+rand+'').val(v1);
};
this._load = function(url){
if(isempt(url))return;
if(get('list_'+rand+'')){
$('#list_'+rand+'').html('