学习基于jQuery的FlexiGrid工具 (十)

2014-11-24 01:40:17 · 作者: · 浏览: 23
css({

top: -hdheight + 'px'

});

$('thead tr:first th', g.hDiv).each(function () {

var cgDiv = document.createElement('div');

$(g.cDrag).append(cgDiv);

if (!p.cgwidth) {

p.cgwidth = $(cgDiv).width();

}

$(cgDiv).css({

height: cdheight + hdheight

}).mousedown(function (e) {

g.dragStart('colresize', e, this);

});

if ($.browser.msie && $.browser.version < 7.0) {

g.fixHeight($(g.gDiv).height());

$(cgDiv).hover(function () {

g.fixHeight();

$(this).addClass('dragging')

}, function () {

if (!g.colresize) $(this).removeClass('dragging')

});

}

});

}

//add strip

if (p.striped) {

$('tbody tr:odd', g.bDiv).addClass('erow');

}

if (p.resizable && p.height != 'auto') {

g.vDiv.className = 'vGrip';

$(g.vDiv).mousedown(function (e) {

g.dragStart('vresize', e)

}).html('');

$(g.bDiv).after(g.vDiv);

}

if (p.resizable && p.width != 'auto' && !p.nohresize) {

g.rDiv.className = 'hGrip';

$(g.rDiv).mousedown(function (e) {

g.dragStart('vresize', e, true);

}).html('').css('height', $(g.gDiv).height());

if ($.browser.msie && $.browser.version < 7.0) {

$(g.rDiv).hover(function () {

$(this).addClass('hgOver');

}, function () {

$(this).removeClass('hgOver');

});

}

$(g.gDiv).append(g.rDiv);

}

// add pager

if (p.usepager) {

g.pDiv.className = 'pDiv';

g.pDiv.innerHTML = '

';

$(g.bDiv).after(g.pDiv);

var html = '

' + p.pagetext + ' ' + p.outof + ' 1
';

$('div', g.pDiv).html(html);

$('.pReload', g.pDiv).click(function () {

g.populate()

});

$('.pFirst', g.pDiv).click(function () {

g.changePage('first')

});

$('.pPrev', g.pDiv).click(function () {

g.changePage('prev')

});

$('.pNext', g.pDiv).click(function () {

g.changePage('next')

});

$('.pLast', g.pDiv).click(function () {

g.changePage('last')

});

$('.pcontrol input', g.pDiv).keydown(function (e) {

if (e.keyCode == 13) g.changePage('input')

});

if ($.browser.msie && $.browser.version < 7) $('.pButton', g.pDiv).hover(function () {

$(this).addClass('pBtnOver');

}, function () {

$(this).removeClass('pBtnOver');

});

if (p.useRp) {

var opt = '',

sel = '';

for (var nx = 0; nx < p.rpOptions.length; nx++) {

if (p.rp == p.rpOptions[nx]) sel = 'selected="selected"';

else sel = '';

opt += "";

}

$('.pDiv2', g.pDiv).prepend("

");

$('select', g.pDiv).change(function () {

if (p.onRpChange) {

p.onRpChange(+this.value);

} else {

p.newp = 1;

p.rp = +this.value;

g.populate();

}

});

}

//add search button

if (p.searchitems) {

$('.pDiv2', g.pDiv).prepend("

");

$('.pSearch', g.pDiv).click(function () {

$(g.sDiv).slideToggle('fast', function () {

$('.sDiv:visible input:first', g.gDiv).trigger('focus');

});

});

//add search box

g.sDiv.className = 'sDiv';

var sitems = p.searchitems;

var sopt = '', sel = '';

for (var s = 0; s < sitems.length; s++) {

if (p.qtype == '' && sitems[s].isdefault == true) {

p.qtype = sitems[s].name;

sel = 'selected="selected"';

} else {

sel = '';

}

sopt += "";

}

if (p.qtype == '') {

p.qtype = sitems[0].name;

}

$(g.sDiv).append("

" + p.findtext +