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

2014-11-24 01:40:17 · 作者: · 浏览: 15
width: '100%'

});

$(g.gDiv).addClass('ie6');

if (p.width != 'auto') {

$(g.gDiv).addClass('ie6fullwidthbug');

}

}

g.rePosDrag();

g.fixHeight();

//make grid functions accessible

t.p = p;

t.grid = g;

// load data

if (p.url && p.autoload) {

g.populate();

}

return t;

};

var docloaded = false;

$(document).ready(function () {

docloaded = true

});

$.fn.flexigrid = function (p) {

return this.each(function () {

if (!docloaded) {

$(this).hide();

var t = this;

$(document).ready(function () {

$.addFlex(t, p);

});

} else {

$.addFlex(this, p);

}

});

}; //end flexigrid

$.fn.flexReload = function (p) { // function to reload grid

return this.each(function () {

if (this.grid && this.p.url) this.grid.populate();

});

}; //end flexReload

$.fn.flexOptions = function (p) { //function to update general options

return this.each(function () {

if (this.grid) $.extend(this.p, p);

});

}; //end flexOptions

$.fn.flexToggleCol = function (cid, visible) { // function to reload grid

return this.each(function () {

if (this.grid) this.grid.toggleCol(cid, visible);

});

}; //end flexToggleCol

$.fn.flexAddData = function (data) { // function to add data to grid

return this.each(function () {

if (this.grid) this.grid.addData(data);

});

};

$.fn.noSelect = function (p) { //no select plugin by me :-)

var prevent = (p == null) true : p;

if (prevent) {

return this.each(function () {

if ($.browser.msie || $.browser.safari) $(this).bind('selectstart', function () {

return false;

});

else if ($.browser.mozilla) {

$(this).css('MozUserSelect', 'none');

$('body').trigger('focus');

} else if ($.browser.opera) $(this).bind('mousedown', function () {

return false;

});

else $(this).attr('unselectable', 'on');

});

} else {

return this.each(function () {

if ($.browser.msie || $.browser.safari) $(this).unbind('selectstart');

else if ($.browser.mozilla) $(this).css('MozUserSelect', 'inherit');

else if ($.browser.opera) $(this).unbind('mousedown');

else $(this).removeAttr('unselectable', 'on');

});

}

}; //end noSelect

})(jQuery);