/*
- * (c) 2005-2009 Richard Cowin (http://openrico.org)
- * (c) 2005-2009 Matt Brown (http://dowdybrown.com)
+ * (c) 2005-2011 Richard Cowin (http://openrico.org)
+ * (c) 2005-2011 Matt Brown (http://dowdybrown.com)
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at
var i;
for (i=0; i<2; i++) {
Rico.log("simpleGridInit "+i);\r
- this.tabs[i]=document.getElementById(this.tableId+'_tab'+i);
+ this.tabs[i]=Rico.$(this.tableId+'_tab'+i);
if (!this.tabs[i]) return;
- this.hdrTabs[i]=document.getElementById(this.tableId+'_tab'+i+'h');
+ this.hdrTabs[i]=Rico.$(this.tableId+'_tab'+i+'h');
if (!this.hdrTabs[i]) return;
- //if (i==0) this.tabs[i].style.position='absolute';
- //if (i==0) this.tabs[i].style.left='0px';
- //this.hdrTabs[i].style.position='absolute';
- //this.hdrTabs[i].style.top='0px';
- //this.hdrTabs[i].style.zIndex=1;
this.thead[i]=this.hdrTabs[i];
this.tbody[i]=this.tabs[i];
this.headerColCnt = this.getColumnInfo(this.hdrTabs[i].rows);
alert('ERROR: no columns found in "'+this.tableId+'"');
return;
}
- //this.hdrHt=Math.max(Rico.nan2zero(this.hdrTabs[0].offsetHeight),this.hdrTabs[1].offsetHeight);
- //for (i=0; i<2; i++) {
- // if (i==0) this.tabs[i].style.top=this.hdrHt+'px';
- //}
this.createColumnArray('SimpleGridColumn');
this.pageSize=this.columns[0].dataColDiv.childNodes.length;
this.sizeDivs();
this.createFilters(this.options.FilterLocation);
this.attachMenuEvents();
this.scrollEventFunc=Rico.eventHandle(this,'handleScroll');
+ this.scrollFrozenEventFunc=Rico.eventHandle(this,'handleScrollFrozen');
+ this.scrollHeadingEventFunc=Rico.eventHandle(this,'handleScrollHeading');
this.pluginScroll();
if (this.options.windowResize)
Rico.eventBind(window,"resize", Rico.eventHandle(this,'sizeDivs'), false);
this.sizeDivs();\r
},
+ pluginScroll: function() {
+ if (this.scrollPluggedIn) return;
+ Rico.eventBind(this.scrollDiv,"scroll",this.scrollEventFunc, false);
+ Rico.eventBind(this.frozenTabs,"scroll",this.scrollFrozenEventFunc, false);
+ Rico.eventBind(this.innerDiv,"scroll",this.scrollHeadingEventFunc, false);
+ this.scrollPluggedIn=true;
+ },
+
+ unplugScroll: function() {
+ Rico.eventUnbind(this.scrollDiv,"scroll", this.scrollEventFunc , false);
+ Rico.eventUnbind(this.frozenTabs,"scroll", this.scrollFrozenEventFunc , false);
+ Rico.eventUnbind(this.innerDiv,"scroll", this.scrollHeadingEventFunc , false);
+ this.scrollPluggedIn=false;
+ },
+
handleScroll: function(e) {
- var newTop=(-this.scrollDiv.scrollTop)+'px';
- this.tabs[0].style.marginTop=newTop;
- this.setHorizontalScroll();
+ this.frozenTabs.scrollTop=this.scrollDiv.scrollTop;
+ this.innerDiv.scrollLeft=this.scrollDiv.scrollLeft;
+ },
+
+ /**
+ * Frozen columns scrolled due to user invoking browser find
+ */
+ handleScrollFrozen: function(e) {
+ this.scrollDiv.scrollTop=this.frozenTabs.scrollTop;
+ },
+
+ /**
+ * Heading scrolled due to user invoking browser find
+ */
+ handleScrollHeading: function(e) {
+ this.scrollDiv.scrollLeft=this.innerDiv.scrollLeft;
},
/**
/**
* Copies all rows to a new window as a simple html table.
*/
- printVisible: function(exportType) {
+ printVisible: function() {
this.showMsg(Rico.getPhraseById('exportInProgress'));
- Rico.runLater(10,this,'_printVisible',exportType); // allow message to paint
+ Rico.runLater(10,this,'_printVisible'); // allow message to paint
},
- _printVisible: function(exportType) {
+ _printVisible: function() {
this.exportStart();
var exportStyles=this.getExportStyles(this.tbody[0]);
for(var r=0; r < this.pageSize; r++) {
}
this.exportRows.push(exportText);
}
- this.exportFinish(exportType);
+ this.exportFinish();
},
/**