Repository: paulopmx/Flexigrid Branch: master Commit: 16cc6ddba5c2 Files: 15 Total size: 187.8 KB Directory structure: gitextract_f0o58vp2/ ├── README.md ├── css/ │ ├── flexigrid.css │ ├── flexigrid.less │ └── flexigrid.pack.css ├── demo/ │ ├── conflict-test.html │ ├── countryArray.inc.php │ ├── example4.php │ ├── index.html │ ├── old-format.json │ ├── post-json.php │ ├── post-xml.php │ ├── sample.html │ └── style.css └── js/ ├── flexigrid.js └── flexigrid.pack.js ================================================ FILE CONTENTS ================================================ ================================================ FILE: README.md ================================================ Flexigrid for jQuery v1.1 ========================== Lightweight but rich data grid with re-sizable columns and a scrolling data to match the headers, plus an ability to connect to an XML or JSON data source using Ajax to load the content. Similar in concept with the Ext Grid only its pure jQuery love, which makes it light weight and follows the jQuery mantra of running with the least amount of configuration. ## Features * Resizable columns * Resizable height and width * Sortable column headers * Cool theme * Can convert an ordinary table * Ability to connect to an ajax data source (XML and JSON) * Paging * Show/hide columns * Toolbar (new) * Search (new) * Accessible API * Resizable Width * JSON Support * Toolbar * Table Toggle Button * Show/Hide Columns control have been move to the column headers (try it by mouseovering a header and clicking a black triangle on the right) * Fixed paging problem on multiple instances * Mootools and Prototype noConflict() compatibility problems fixed * New onError event on ajax interaction, (it will pass what the server said in a variable called data), allowing you to handle server problems * New $().flexAddData method, allows you to directly add new data to the grid using your own data source. * New preProcess API, allows you to modify or process data sent by server before passing it to Flexigrid, allowing you to use your own JSON format for example. * Single Rows Select just use { singleSelect: true } in the options * Quick Search ## License Copyright (c) 2008 Paulo P. Marinas (https://github.com/paulopmx/Flexigrid) Dual licensed under the MIT or GPL Version 2 licenses. http://jquery.org/license ================================================ FILE: css/flexigrid.css ================================================ @charset "UTF-8"; /* CSS Document */ .flexigrid { font-family: Arial, Helvetica, sans-serif; font-size: 11px; line-height: normal; position: relative; border: 0px solid #eee; overflow: hidden; color: #000; } .flexigrid.hideBody { height: 26px !important; border-bottom: 1px solid #ccc; } .ie6fullwidthbug { border-right: 0px solid #ccc; padding-right: 2px; } .flexigrid div.nDiv { background: #eee url(images/line.gif) repeat-y -1px top; border: 1px solid #ccc; border-top: 0px; overflow: auto; left: 0px; position: absolute; z-index: 999; float: left; } .flexigrid div.nDiv table { margin: 2px; } .flexigrid div.hDivBox { float: left; padding-right: 40px; } .flexigrid div.bDiv table { margin-bottom: 10px; } .flexigrid div.bDiv table.autoht { border-bottom: 0px; margin-bottom: 0px; } .flexigrid div.nDiv td { padding: 2px 3px; border: 1px solid #eee; cursor: default; } .flexigrid div.nDiv tr:hover td,.flexigrid div.nDiv tr.ndcolover td { background: #d5effc url(images/hl.png) repeat-x top; border: 1px solid #a8d8eb; } .flexigrid div.nDiv td.ndcol1 { border-right: 1px solid #ccc; } .flexigrid div.nDiv td.ndcol2 { border-left: 1px solid #fff; padding-right: 10px; } .flexigrid div.nDiv tr:hover td.ndcol1,.flexigrid div.nDiv tr.ndcolover td.ndcol1 { border-right: 1px solid #d2e3ec; } .flexigrid div.nDiv tr:hover td.ndcol2,.flexigrid div.nDiv tr.ndcolover td.ndcol2 { border-left: 1px solid #eef8ff; } .flexigrid div.nBtn { position: absolute; height: 24px; width: 14px; z-index: 900; background: #fafafa url(images/fhbg.gif) repeat-x bottom; border: 0px solid #ccc; border-left: 1px solid #ccc; top: 0px; left: 0px; margin-top: 1px; cursor: pointer; display: none; } .flexigrid div.nBtn div { height: 24px; width: 12px; border-left: 1px solid #fff; float: left; background: url(images/ddn.png) no-repeat center; } .flexigrid div.nBtn.srtd { background: url(images/wbg.gif) repeat-x 0px -1px; } .flexigrid div.mDiv { background: url(images/wbg.gif) repeat-x top; border: 1px solid #ccc; border-bottom: 0px; border-top: 0px; font-weight: bold; display: block; overflow: hidden; white-space: nowrap; position: relative; } .flexigrid div.mDiv div { padding: 6px; white-space: nowrap; } .flexigrid div.mDiv div.ptogtitle { position: absolute; top: 4px; right: 3px; padding: 0px; height: 16px; width: 16px; overflow: hidden; border: 1px solid #ccc; cursor: pointer; } .flexigrid div.mDiv div.ptogtitle:hover { background-position: left -2px; border-color: #bbb; } .flexigrid div.mDiv div.ptogtitle span { display: block; border-left: 1px solid #eee; border-top: 1px solid #fff; border-bottom: 1px solid #ddd; width: 14px; height: 14px; background: url(images/uup.png) no-repeat center; } .flexigrid div.mDiv div.ptogtitle.vsble span { background: url(images/ddn.png) no-repeat center; } .flexigrid div.tDiv /*toolbar*/ { background: #fafafa url(images/bg.gif) repeat-x top; position: relative; border: 1px solid #ccc; border-bottom: 0px; overflow: hidden; } .flexigrid div.tDiv2 { float: left; clear: both; padding: 1px; } .flexigrid div.sDiv /*toolbar*/ { background: #fafafa url(images/bg.gif) repeat-x top; position: relative; border: 1px solid #ccc; border-top: 0px; overflow: hidden; display: none; } .flexigrid div.sDiv2 { float: left; clear: both; padding: 5px; padding-left: 5px; width: 1024px; } .flexigrid div.sDiv2 input,.flexigrid div.sDiv2 select { vertical-align: middle; } .flexigrid div.btnseparator { float: left; height: 22px; border-left: 1px solid #ccc; border-right: 1px solid #fff; margin: 1px; } .flexigrid div.fbutton { float: left; display: block; cursor: pointer; padding: 1px; } .flexigrid div.fbutton div { float: left; padding: 1px 3px; } .flexigrid div.fbutton span { float: left; display: block; padding: 3px; } .flexigrid div.fbutton:hover,.flexigrid div.fbutton.fbOver { padding: 0px; border: 1px solid #ccc; } .flexigrid div.fbutton:hover div,.flexigrid div.fbutton.fbOver div { padding: 0px 2px; border-left: 1px solid #fff; border-top: 1px solid #fff; border-right: 1px solid #eee; border-bottom: 1px solid #eee; } /* end toolbar*/ .flexigrid div.hDiv { background: #fafafa url(images/fhbg.gif) repeat-x bottom; position: relative; border: 1px solid #ccc; border-bottom: 0px; overflow: hidden; } .flexigrid div.hDiv table { border-right: 1px solid #fff; } .flexigrid div.cDrag { float: left; position: absolute; z-index: 2; overflow: visible; } .flexigrid div.cDrag div { float: left; background: none; display: block; position: absolute; height: 24px; width: 5px; cursor: col-resize; } .flexigrid div.cDrag div:hover,.flexigrid div.cDrag div.dragging { background: url(images/line.gif) repeat-y 2px center; } .flexigrid div.iDiv { border: 1px solid #316ac5; position: absolute; overflow: visible; background: none; } .flexigrid div.iDiv input,.flexigrid div.iDiv select,.flexigrid div.iDiv textarea { font-family: Arial, Helvetica, sans-serif; font-size: 11px; } .flexigrid div.iDiv input.tb { border: 0px; padding: 0px; width: 100%; height: 100%; padding: 0px; background: none; } .flexigrid div.bDiv { border: 1px solid #ccc; border-top: 0px; background: #fff; overflow: auto; position: relative; } .flexigrid div.bDiv table { border-bottom: 1px solid #ccc; } .flexigrid div.hGrip { position: absolute; top: 0px; right: 0px; height: 5px; width: 5px; background: url(images/line.gif) repeat-x center; margin-right: 1px; cursor: col-resize; } .flexigrid div.hGrip:hover,.flexigrid div.hGrip.hgOver { border-right: 1px solid #999; margin-right: 0px; } .flexigrid div.vGrip { height: 5px; overflow: hidden; position: relative; background: #fafafa url(images/wbg.gif) repeat-x 0px -1px; border: 1px solid #ccc; border-top: 0px; text-align: center; cursor: row-resize; } .flexigrid div.vGrip span { display: block; margin: 1px auto; width: 20px; height: 1px; overflow: hidden; border-top: 1px solid #aaa; border-bottom: 1px solid #aaa; background: none; } .flexigrid div.hDiv th,.flexigrid div.bDiv td /* common cell properties*/ { text-align: left; border-right: 1px solid #ddd; border-left: 1px solid #fff; overflow: hidden; vertical-align: top !important; padding-left: 0; padding-right: 0; } .flexigrid div.hDiv th div,.flexigrid div.bDiv td div,div.colCopy div /* common inner cell properties*/ { padding: 5px; border-left: 0px solid #fff; } .flexigrid div.hDiv th,div.colCopy { font-weight: normal; height: 24px; cursor: default; white-space: nowrap; overflow: hidden; } div.colCopy { font-family: Arial, Helvetica, sans-serif; font-size: 11px; background: #fafafa url(images/fhbg.gif) repeat-x bottom; border: 1px solid #ccc; border-bottom: 0px; overflow: hidden; } .flexigrid div.hDiv th.sorted { background: url(images/wbg.gif) repeat-x 0px -1px; border-bottom: 0px solid #ccc; } .flexigrid div.hDiv th.thOver { } .flexigrid div.hDiv th.thOver div,.flexigrid div.hDiv th.sorted.thOver div { border-bottom: 1px solid orange; padding-bottom: 4px; } .flexigrid div.hDiv th.sorted div { border-bottom: 0px solid #ccc; padding-bottom: 5px; } .flexigrid div.hDiv th.thMove { background: #fff; color: #fff; } .flexigrid div.hDiv th.sorted.thMove div { border-bottom: 1px solid #fff; padding-bottom: 4px } .flexigrid div.hDiv th.thMove div { background: #fff !important; } .flexigrid div.hDiv th div.sdesc { background: url(images/dn.png) no-repeat center top; } .flexigrid div.hDiv th div.sasc { background: url(images/up.png) no-repeat center top; } .flexigrid div.bDiv td { border-bottom: 1px solid #fff; vertical-align: top; white-space: nowrap; } .flexigrid div.hDiv th div { } .flexigrid span.cdropleft { display: block; background: url(images/prev.gif) no-repeat -4px center; width: 24px; height: 24px; position: relative; top: -24px; margin-bottom: -24px; z-index: 3; } .flexigrid div.hDiv span.cdropright { display: block; background: url(images/next.gif) no-repeat 12px center; width: 24px; height: 24px; float: right; position: relative; top: -24px; margin-bottom: -24px; } .flexigrid div.bDiv td div { border-top: 0px solid #fff; padding-bottom: 4px; } .flexigrid tr td.sorted { background: #f3f3f3; border-right: 1px solid #ddd; border-bottom: 1px solid #f3f3f3; } .flexigrid tr td.sorted div { } .flexigrid tr.erow td { background: #f7f7f7; border-bottom: 1px solid #f7f7f7; } .flexigrid tr.erow td.sorted { background: #e3e3e3; border-bottom: 1px solid #e3e3e3; } .flexigrid tr.erow td.sorted div { } .flexigrid div.bDiv tr:hover td,.flexigrid div.bDiv tr:hover td.sorted,.flexigrid div.bDiv tr.trOver td.sorted,.flexigrid div.bDiv tr.trOver td { background: #d9ebf5; border-left: 1px solid #eef8ff; border-bottom: 1px dotted #a8d8eb; } .flexigrid div.bDiv tr.trSelected:hover td,.flexigrid div.bDiv tr.trSelected:hover td.sorted,.flexigrid div.bDiv tr.trOver.trSelected td.sorted,.flexigrid div.bDiv tr.trOver.trSelected td,.flexigrid tr.trSelected td.sorted,.flexigrid tr.trSelected td { background: #d5effc url(images/hl.png) repeat-x top; border-right: 1px solid #d2e3ec; border-left: 1px solid #eef8ff; border-bottom: 1px solid #a8d8eb; } /* novstripe adjustments */ .flexigrid.novstripe .bDiv table { border-bottom: 1px solid #ccc; border-right: 1px solid #ccc; } .flexigrid.novstripe div.bDiv td { border-right-color: #fff; } .flexigrid.novstripe div.bDiv tr.erow td.sorted { border-right-color: #e3e3e3; } .flexigrid.novstripe div.bDiv tr td.sorted { border-right-color: #f3f3f3; } .flexigrid.novstripe div.bDiv tr.erow td { border-right-color: #f7f7f7; border-left-color: #f7f7f7; } .flexigrid.novstripe div.bDiv tr.trSelected:hover td,.flexigrid.novstripe div.bDiv tr.trSelected:hover td.sorted,.flexigrid.novstripe div.bDiv tr.trOver.trSelected td.sorted,.flexigrid.novstripe div.bDiv tr.trOver.trSelected td,.flexigrid.novstripe tr.trSelected td.sorted,.flexigrid.novstripe tr.trSelected td { border-right: 1px solid #0066FF; border-left: 1px solid #0066FF; } .flexigrid.novstripe div.bDiv tr.trOver td,.flexigrid.novstripe div.bDiv tr:hover td { border-left-color: #d9ebf5; border-right-color: #d9ebf5; } /* end novstripe */ .flexigrid div.pDiv { background: url(images/wbg.gif) repeat-x 0 -1px; border: 1px solid #ccc; border-top: 0px; overflow: hidden; white-space: nowrap; position: relative; } .flexigrid div.pDiv div.pDiv2 { margin: 3px; margin-left: -2px; float: left; width: 1024px; } div.pGroup { float: left; background: none; height: 24px; margin: 0px 5px; } .flexigrid div.pDiv .pPageStat,.flexigrid div.pDiv .pcontrol { position: relative; top: 5px; overflow: visible; } .flexigrid div.pDiv input { vertical-align: text-top; position: relative; top: -5px; margin: 3px; } .flexigrid div.pDiv select { margin: 3px; } .flexigrid div.pDiv div.pButton { float: left; width: 22px; height: 22px; border: 0px; cursor: pointer; overflow: hidden; } .flexigrid div.pDiv div.pButton:hover,.flexigrid div.pDiv div.pButton.pBtnOver { width: 20px; height: 20px; border: 1px solid #ccc; cursor: pointer; } .flexigrid div.pDiv div.pButton span { width: 20px; height: 20px; display: block; float: left; } .flexigrid div.pDiv div.pButton:hover span,.flexigrid div.pDiv div.pButton.pBtnOver span { width: 19px; height: 19px; border-top: 1px solid #fff; border-left: 1px solid #fff; } .flexigrid .pSearch { background: url(images/magnifier.png) no-repeat center; } .flexigrid .pFirst { background: url(images/first.gif) no-repeat center; } .flexigrid .pPrev { background: url(images/prev.gif) no-repeat center; } .flexigrid .pNext { background: url(images/next.gif) no-repeat center; } .flexigrid .pLast { background: url(images/last.gif) no-repeat center; } .flexigrid .pReload { background: url(images/load.png) no-repeat center; } .flexigrid .pReload.loading { background: url(images/load.gif) no-repeat center; } /* ie adjustments */ .flexigrid.ie div.hDiv th div,.flexigrid.ie div.bDiv td div,div.colCopy.ie div /* common inner cell properties*/ { overflow: hidden; } ================================================ FILE: css/flexigrid.less ================================================ @charset "UTF-8"; @basecolor: #fff; @forecolor: #000; @borderlight1: #fff; @borderlight2: #eee; @borderlight3: #ddd; @borderlight4: #ccc; @borderlight5: #bbb; @borderlight6: #aaa; @borderlight7: #f7f7f7; @borderlight8: #f3f3f3; @borderlight9: #eef8ff; @borderlight10: #e3e3e3; @borderlight11: #d9ebf5; @borderlight12: #d2e3ec; @borderlight13: #a8d8eb; @borderlight14: #999; @borderlight15: #316ac5; @borderlight16: #0066FF; @back1: #fafafa; @back2: #f7f7f7; @back3: #f3f3f3; @back4: #eee; @back5: #e3e3e3; @back6: #d5effc; .background-gradient (@start: #000) { background: @start; background: -moz-linear-gradient(top, @start 0%, darken(@start,10%) 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,@start), color-stop(100%,darken(@start,10%))); background: -webkit-linear-gradient(top, @start 0%,darken(@start,10%) 100%); background: -o-linear-gradient(top, @start 0%,darken(@start,10%) 100%); background: -ms-linear-gradient(top, @start 0%,darken(@start,10%) 100%); background: linear-gradient(to bottom, @start 0%,darken(@start,10%) 100%); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr=@start, endColorstr=darken(@start,10%),GradientType=0 ); } /* CSS Document */ .flexigrid { font-family: Arial, Helvetica, sans-serif; font-size: 11px; line-height: normal; position: relative; border: 0px solid @borderlight2; overflow: hidden; color: @forecolor; } .flexigrid.hideBody { height: 26px !important; border-bottom: 1px solid @borderlight4; } .ie6fullwidthbug { border-right: 0px solid @borderlight4; padding-right: 2px; } .flexigrid div.nDiv { background: @back4 url(images/line.gif) repeat-y -1px top; border: 1px solid @borderlight4; border-top: 0px; overflow: auto; left: 0px; position: absolute; z-index: 999; float: left; } .flexigrid div.nDiv table { margin: 2px; } .flexigrid div.hDivBox { float: left; padding-right: 40px; } .flexigrid div.bDiv table { margin-bottom: 10px; } .flexigrid div.bDiv table.autoht { border-bottom: 0px; margin-bottom: 0px; } .flexigrid div.nDiv td { padding: 2px 3px; border: 1px solid @borderlight2; cursor: default; } .flexigrid div.nDiv tr:hover td,.flexigrid div.nDiv tr.ndcolover td { background: @back6 url(images/hl.png) repeat-x top; border: 1px solid @borderlight13; } .flexigrid div.nDiv td.ndcol1 { border-right: 1px solid @borderlight4; } .flexigrid div.nDiv td.ndcol2 { border-left: 1px solid @borderlight1; padding-right: 10px; } .flexigrid div.nDiv tr:hover td.ndcol1,.flexigrid div.nDiv tr.ndcolover td.ndcol1 { border-right: 1px solid @borderlight12; } .flexigrid div.nDiv tr:hover td.ndcol2,.flexigrid div.nDiv tr.ndcolover td.ndcol2 { border-left: 1px solid @borderlight9; } .flexigrid div.nBtn { position: absolute; height: 24px; width: 14px; z-index: 900; background: @back1 url(images/fhbg.gif) repeat-x bottom; /*.background-gradient(@back1);*/ border: 0px solid @borderlight4; border-left: 1px solid @borderlight4; top: 0px; left: 0px; margin-top: 1px; cursor: pointer; display: none; } .flexigrid div.nBtn div { height: 24px; width: 12px; border-left: 1px solid @borderlight1; float: left; background: url(images/ddn.png) no-repeat center; } .flexigrid div.nBtn.srtd { background: url(images/wbg.gif) repeat-x 0px -1px; } .flexigrid div.mDiv { background: url(images/wbg.gif) repeat-x top; border: 1px solid @borderlight4; border-bottom: 0px; border-top: 0px; font-weight: bold; display: block; overflow: hidden; white-space: nowrap; position: relative; } .flexigrid div.mDiv div { padding: 6px; white-space: nowrap; } .flexigrid div.mDiv div.ptogtitle { position: absolute; top: 4px; right: 3px; padding: 0px; height: 16px; width: 16px; overflow: hidden; border: 1px solid @borderlight4; cursor: pointer; } .flexigrid div.mDiv div.ptogtitle:hover { background-position: left -2px; border-color: @borderlight5; } .flexigrid div.mDiv div.ptogtitle span { display: block; border-left: 1px solid @borderlight2; border-top: 1px solid @borderlight1; border-bottom: 1px solid @borderlight3; width: 14px; height: 14px; background: url(images/uup.png) no-repeat center; } .flexigrid div.mDiv div.ptogtitle.vsble span { background: url(images/ddn.png) no-repeat center; } .flexigrid div.tDiv /*toolbar*/ { background: @back1 url(images/bg.gif) repeat-x top; position: relative; border: 1px solid @borderlight4; border-bottom: 0px; overflow: hidden; } .flexigrid div.tDiv2 { float: left; clear: both; padding: 1px; } .flexigrid div.sDiv /*toolbar*/ { background: @back1 url(images/bg.gif) repeat-x top; position: relative; border: 1px solid @borderlight4; border-top: 0px; overflow: hidden; display: none; } .flexigrid div.sDiv2 { float: left; clear: both; padding: 5px; padding-left: 5px; width: 1024px; } .flexigrid div.sDiv2 input,.flexigrid div.sDiv2 select { vertical-align: middle; } .flexigrid div.btnseparator { float: left; height: 22px; border-left: 1px solid @borderlight4; border-right: 1px solid @borderlight1; margin: 1px; } .flexigrid div.fbutton { float: left; display: block; cursor: pointer; padding: 1px; } .flexigrid div.fbutton div { float: left; padding: 1px 3px; } .flexigrid div.fbutton span { float: left; display: block; padding: 3px; } .flexigrid div.fbutton:hover,.flexigrid div.fbutton.fbOver { padding: 0px; border: 1px solid @borderlight4; } .flexigrid div.fbutton:hover div,.flexigrid div.fbutton.fbOver div { padding: 0px 2px; border-left: 1px solid @borderlight1; border-top: 1px solid @borderlight1; border-right: 1px solid @borderlight2; border-bottom: 1px solid @borderlight2; } /* end toolbar*/ .flexigrid div.hDiv { background: @back1 url(images/fhbg.gif) repeat-x bottom; /*.background-gradient(@back1);*/ position: relative; border: 1px solid @borderlight4; border-bottom: 0px; overflow: hidden; } .flexigrid div.hDiv table { border-right: 1px solid @borderlight1; } .flexigrid div.cDrag { float: left; position: absolute; z-index: 2; overflow: visible; } .flexigrid div.cDrag div { float: left; background: none; display: block; position: absolute; height: 24px; width: 5px; cursor: col-resize; } .flexigrid div.cDrag div:hover,.flexigrid div.cDrag div.dragging { background: url(images/line.gif) repeat-y 2px center; } .flexigrid div.iDiv { border: 1px solid @borderlight15; position: absolute; overflow: visible; background: none; } .flexigrid div.iDiv input,.flexigrid div.iDiv select,.flexigrid div.iDiv textarea { font-family: Arial, Helvetica, sans-serif; font-size: 11px; } .flexigrid div.iDiv input.tb { border: 0px; padding: 0px; width: 100%; height: 100%; padding: 0px; background: none; } .flexigrid div.bDiv { border: 1px solid @borderlight4; border-top: 0px; background: @basecolor; overflow: auto; position: relative; } .flexigrid div.bDiv table { border-bottom: 1px solid @borderlight4; } .flexigrid div.hGrip { position: absolute; top: 0px; right: 0px; height: 5px; width: 5px; background: url(images/line.gif) repeat-x center; margin-right: 1px; cursor: col-resize; } .flexigrid div.hGrip:hover,.flexigrid div.hGrip.hgOver { border-right: 1px solid @borderlight14; margin-right: 0px; } .flexigrid div.vGrip { height: 5px; overflow: hidden; position: relative; background: @back1 url(images/wbg.gif) repeat-x 0px -1px; border: 1px solid @borderlight4; border-top: 0px; text-align: center; cursor: row-resize; } .flexigrid div.vGrip span { display: block; margin: 1px auto; width: 20px; height: 1px; overflow: hidden; border-top: 1px solid @borderlight6; border-bottom: 1px solid @borderlight6; background: none; } .flexigrid div.hDiv th,.flexigrid div.bDiv td /* common cell properties*/ { text-align: left; border-right: 1px solid @borderlight3; border-left: 1px solid @borderlight1; overflow: hidden; vertical-align: top !important; padding-left: 0; padding-right: 0; } .flexigrid div.hDiv th div,.flexigrid div.bDiv td div,div.colCopy div /* common inner cell properties*/ { padding: 5px; border-left: 0px solid @borderlight1; } .flexigrid div.hDiv th,div.colCopy { font-weight: normal; height: 24px; cursor: default; white-space: nowrap; overflow: hidden; } div.colCopy { font-family: Arial, Helvetica, sans-serif; font-size: 11px; background: @back1 url(images/fhbg.gif) repeat-x bottom; /*.background-gradient(@back1);*/ border: 1px solid @borderlight4; border-bottom: 0px; overflow: hidden; } .flexigrid div.hDiv th.sorted { background: url(images/wbg.gif) repeat-x 0px -1px; border-bottom: 0px solid @borderlight4; } .flexigrid div.hDiv th.thOver { } .flexigrid div.hDiv th.thOver div,.flexigrid div.hDiv th.sorted.thOver div { border-bottom: 1px solid orange; padding-bottom: 4px; } .flexigrid div.hDiv th.sorted div { border-bottom: 0px solid @borderlight4; padding-bottom: 5px; } .flexigrid div.hDiv th.thMove { background: @basecolor; color: @basecolor; } .flexigrid div.hDiv th.sorted.thMove div { border-bottom: 1px solid @borderlight1; padding-bottom: 4px } .flexigrid div.hDiv th.thMove div { background: @basecolor !important; } .flexigrid div.hDiv th div.sdesc { background: url(images/dn.png) no-repeat center top; } .flexigrid div.hDiv th div.sasc { background: url(images/up.png) no-repeat center top; } .flexigrid div.bDiv td { border-bottom: 1px solid @borderlight1; vertical-align: top; white-space: nowrap; } .flexigrid div.hDiv th div { } .flexigrid span.cdropleft { display: block; background: url(images/prev.gif) no-repeat -4px center; width: 24px; height: 24px; position: relative; top: -24px; margin-bottom: -24px; z-index: 3; } .flexigrid div.hDiv span.cdropright { display: block; background: url(images/next.gif) no-repeat 12px center; width: 24px; height: 24px; float: right; position: relative; top: -24px; margin-bottom: -24px; } .flexigrid div.bDiv td div { border-top: 0px solid @borderlight1; padding-bottom: 4px; } .flexigrid tr td.sorted { background: @back3; border-right: 1px solid @borderlight3; border-bottom: 1px solid @borderlight8; } .flexigrid tr td.sorted div { } .flexigrid tr.erow td { background: @back2; border-bottom: 1px solid @borderlight7; } .flexigrid tr.erow td.sorted { background: @back5; border-bottom: 1px solid @borderlight10; } .flexigrid tr.erow td.sorted div { } .flexigrid div.bDiv tr:hover td,.flexigrid div.bDiv tr:hover td.sorted,.flexigrid div.bDiv tr.trOver td.sorted,.flexigrid div.bDiv tr.trOver td { background: @borderlight11; border-left: 1px solid @borderlight9; border-bottom: 1px dotted @borderlight13; } .flexigrid div.bDiv tr.trSelected:hover td,.flexigrid div.bDiv tr.trSelected:hover td.sorted,.flexigrid div.bDiv tr.trOver.trSelected td.sorted,.flexigrid div.bDiv tr.trOver.trSelected td,.flexigrid tr.trSelected td.sorted,.flexigrid tr.trSelected td { background: @back6 url(images/hl.png) repeat-x top; border-right: 1px solid @borderlight12; border-left: 1px solid @borderlight9; border-bottom: 1px solid @borderlight13; } /* novstripe adjustments */ .flexigrid.novstripe .bDiv table { border-bottom: 1px solid @borderlight4; border-right: 1px solid @borderlight4; } .flexigrid.novstripe div.bDiv td { border-right-color: @borderlight1; } .flexigrid.novstripe div.bDiv tr.erow td.sorted { border-right-color: @borderlight10; } .flexigrid.novstripe div.bDiv tr td.sorted { border-right-color: @borderlight8; } .flexigrid.novstripe div.bDiv tr.erow td { border-right-color: @borderlight7; border-left-color: @borderlight7; } .flexigrid.novstripe div.bDiv tr.trSelected:hover td,.flexigrid.novstripe div.bDiv tr.trSelected:hover td.sorted,.flexigrid.novstripe div.bDiv tr.trOver.trSelected td.sorted,.flexigrid.novstripe div.bDiv tr.trOver.trSelected td,.flexigrid.novstripe tr.trSelected td.sorted,.flexigrid.novstripe tr.trSelected td { border-right: 1px solid @borderlight16; border-left: 1px solid @borderlight16; } .flexigrid.novstripe div.bDiv tr.trOver td,.flexigrid.novstripe div.bDiv tr:hover td { border-left-color: @borderlight11; border-right-color: @borderlight11; } /* end novstripe */ .flexigrid div.pDiv { background: url(images/wbg.gif) repeat-x 0 -1px; border: 1px solid @borderlight4; border-top: 0px; overflow: hidden; white-space: nowrap; position: relative; } .flexigrid div.pDiv div.pDiv2 { margin: 3px; margin-left: -2px; float: left; width: 1024px; } div.pGroup { float: left; background: none; height: 24px; margin: 0px 5px; } .flexigrid div.pDiv .pPageStat,.flexigrid div.pDiv .pcontrol { position: relative; top: 5px; overflow: visible; } .flexigrid div.pDiv input { vertical-align: text-top; position: relative; top: -5px; margin: 3px; } .flexigrid div.pDiv select { margin: 3px; } .flexigrid div.pDiv div.pButton { float: left; width: 22px; height: 22px; border: 0px; cursor: pointer; overflow: hidden; } .flexigrid div.pDiv div.pButton:hover,.flexigrid div.pDiv div.pButton.pBtnOver { width: 20px; height: 20px; border: 1px solid @borderlight4; cursor: pointer; } .flexigrid div.pDiv div.pButton span { width: 20px; height: 20px; display: block; float: left; } .flexigrid div.pDiv div.pButton:hover span,.flexigrid div.pDiv div.pButton.pBtnOver span { width: 19px; height: 19px; border-top: 1px solid @borderlight1; border-left: 1px solid @borderlight1; } .flexigrid .pSearch { background: url(images/magnifier.png) no-repeat center; } .flexigrid .pFirst { background: url(images/first.gif) no-repeat center; } .flexigrid .pPrev { background: url(images/prev.gif) no-repeat center; } .flexigrid .pNext { background: url(images/next.gif) no-repeat center; } .flexigrid .pLast { background: url(images/last.gif) no-repeat center; } .flexigrid .pReload { background: url(images/load.png) no-repeat center; } .flexigrid .pReload.loading { background: url(images/load.gif) no-repeat center; } /* ie adjustments */ .flexigrid.ie div.hDiv th div,.flexigrid.ie div.bDiv td div,div.colCopy.ie div /* common inner cell properties*/ { overflow: hidden; } ================================================ FILE: css/flexigrid.pack.css ================================================ @charset UTF-8; .flexigrid{font-family:Arial, Helvetica, sans-serif;font-size:11px;position:relative;border:0 solid #eee;overflow:hidden;color:#000} .flexigrid.hideBody{height:26px!important;border-bottom:1px solid #ccc} .ie6fullwidthbug{border-right:0 solid #ccc;padding-right:2px} .flexigrid div.nDiv{background:#eee url(images/line.gif) repeat-y -1px top;border:1px solid #ccc;border-top:0;overflow:auto;left:0;position:absolute;z-index:999;float:left} .flexigrid div.nDiv table{margin:2px} .flexigrid div.hDivBox{float:left;padding-right:40px} .flexigrid div.bDiv table{margin-bottom:10px;border-bottom:1px solid #ccc} .flexigrid div.bDiv table.autoht{border-bottom:0;margin-bottom:0} .flexigrid div.nDiv td{border:1px solid #eee;cursor:default;padding:2px 3px} .flexigrid div.nDiv tr:hover td,.flexigrid div.nDiv tr.ndcolover td{background:#d5effc url(images/hl.png) repeat-x top;border:1px solid #a8d8eb} .flexigrid div.nDiv td.ndcol1{border-right:1px solid #ccc} .flexigrid div.nDiv td.ndcol2{border-left:1px solid #fff;padding-right:10px} .flexigrid div.nDiv tr:hover td.ndcol1,.flexigrid div.nDiv tr.ndcolover td.ndcol1{border-right:1px solid #d2e3ec} .flexigrid div.nDiv tr:hover td.ndcol2,.flexigrid div.nDiv tr.ndcolover td.ndcol2{border-left:1px solid #eef8ff} .flexigrid div.nBtn{position:absolute;height:24px;width:14px;z-index:900;background:#fafafa url(images/fhbg.gif) repeat-x bottom;border:0 solid #ccc;border-left:1px solid #ccc;top:0;left:0;margin-top:1px;cursor:pointer;display:none} .flexigrid div.nBtn div{height:24px;width:12px;border-left:1px solid #fff;float:left;background:url(images/ddn.png) no-repeat center} .flexigrid div.nBtn.srtd{background:url(images/wbg.gif) repeat-x 0 -1px} .flexigrid div.mDiv{background:url(images/wbg.gif) repeat-x top;border:1px solid #ccc;border-bottom:0;border-top:0;font-weight:700;display:block;overflow:hidden;white-space:nowrap;position:relative} .flexigrid div.mDiv div{white-space:nowrap;padding:6px} .flexigrid div.mDiv div.ptogtitle{position:absolute;top:4px;right:3px;height:16px;width:16px;overflow:hidden;border:1px solid #ccc;cursor:pointer;padding:0} .flexigrid div.mDiv div.ptogtitle:hover{background-position:left -2px;border-color:#bbb} .flexigrid div.mDiv div.ptogtitle span{display:block;border-left:1px solid #eee;border-top:1px solid #fff;border-bottom:1px solid #ddd;width:14px;height:14px;background:url(images/uup.png) no-repeat center} .flexigrid div.mDiv div.ptogtitle.vsble span{background:url(images/ddn.png) no-repeat center} .flexigrid div.tDiv /*toolbar*/{background:#fafafa url(images/bg.gif) repeat-x top;position:relative;border:1px solid #ccc;border-bottom:0;overflow:hidden} .flexigrid div.tDiv2{float:left;clear:both;padding:1px} .flexigrid div.sDiv /*toolbar*/{background:#fafafa url(images/bg.gif) repeat-x top;position:relative;border:1px solid #ccc;border-top:0;overflow:hidden;display:none} .flexigrid div.sDiv2{float:left;clear:both;width:1024px;padding:5px} .flexigrid div.sDiv2 input,.flexigrid div.sDiv2 select{vertical-align:middle} .flexigrid div.btnseparator{float:left;height:22px;border-left:1px solid #ccc;border-right:1px solid #fff;margin:1px} .flexigrid div.fbutton{float:left;display:block;cursor:pointer;padding:1px} .flexigrid div.fbutton div{float:left;padding:1px 3px} .flexigrid div.fbutton span{float:left;display:block;padding:3px} .flexigrid div.fbutton:hover,.flexigrid div.fbutton.fbOver{border:1px solid #ccc;padding:0} .flexigrid div.fbutton:hover div,.flexigrid div.fbutton.fbOver div{border-left:1px solid #fff;border-top:1px solid #fff;border-right:1px solid #eee;border-bottom:1px solid #eee;padding:0 2px} .flexigrid div.hDiv{background:#fafafa url(images/fhbg.gif) repeat-x bottom;position:relative;border:1px solid #ccc;border-bottom:0;overflow:hidden} .flexigrid div.hDiv table{border-right:1px solid #fff} .flexigrid div.cDrag{float:left;position:absolute;z-index:2;overflow:visible} .flexigrid div.cDrag div{float:left;background:none;display:block;position:absolute;height:24px;width:5px;cursor:col-resize} .flexigrid div.cDrag div:hover,.flexigrid div.cDrag div.dragging{background:url(images/line.gif) repeat-y 2px center} .flexigrid div.iDiv{border:1px solid #316ac5;position:absolute;overflow:visible;background:none} .flexigrid div.iDiv input,.flexigrid div.iDiv select,.flexigrid div.iDiv textarea{font-family:Arial, Helvetica, sans-serif;font-size:11px} .flexigrid div.iDiv input.tb{border:0;width:100%;height:100%;background:none;padding:0} .flexigrid div.bDiv{border:1px solid #ccc;border-top:0;background:#fff;overflow:auto;position:relative} .flexigrid div.hGrip{position:absolute;top:0;right:0;height:5px;width:5px;background:url(images/line.gif) repeat-x center;margin-right:1px;cursor:col-resize} .flexigrid div.hGrip:hover,.flexigrid div.hGrip.hgOver{border-right:1px solid #999;margin-right:0} .flexigrid div.vGrip{height:5px;overflow:hidden;position:relative;background:#fafafa url(images/wbg.gif) repeat-x 0 -1px;border:1px solid #ccc;border-top:0;text-align:center;cursor:row-resize} .flexigrid div.vGrip span{display:block;width:20px;height:1px;overflow:hidden;border-top:1px solid #aaa;border-bottom:1px solid #aaa;background:none;margin:1px auto} .flexigrid div.hDiv th,.flexigrid div.bDiv td /* common cell properties*/{text-align:left;border-right:1px solid #ddd;border-left:1px solid #fff;overflow:hidden;vertical-align:top!important;padding-left:0;padding-right:0} .flexigrid div.hDiv th div,.flexigrid div.bDiv td div,div.colCopy div /* common inner cell properties*/{border-left:0 solid #fff;padding:5px} .flexigrid div.hDiv th,div.colCopy{font-weight:400;height:24px;cursor:default;white-space:nowrap;overflow:hidden} div.colCopy{font-family:Arial, Helvetica, sans-serif;font-size:11px;background:#fafafa url(images/fhbg.gif) repeat-x bottom;border:1px solid #ccc;border-bottom:0;overflow:hidden} .flexigrid div.hDiv th.sorted{background:url(images/wbg.gif) repeat-x 0 -1px;border-bottom:0 solid #ccc} .flexigrid div.hDiv th.thOver div,.flexigrid div.hDiv th.sorted.thOver div{border-bottom:1px solid orange;padding-bottom:4px} .flexigrid div.hDiv th.sorted div{border-bottom:0 solid #ccc;padding-bottom:5px} .flexigrid div.hDiv th.thMove{background:#fff;color:#fff} .flexigrid div.hDiv th.sorted.thMove div{border-bottom:1px solid #fff;padding-bottom:4px} .flexigrid div.hDiv th.thMove div{background:#fff!important} .flexigrid div.hDiv th div.sdesc{background:url(images/dn.png) no-repeat center top} .flexigrid div.hDiv th div.sasc{background:url(images/up.png) no-repeat center top} .flexigrid div.bDiv td{border-bottom:1px solid #fff;vertical-align:top;white-space:nowrap} .flexigrid span.cdropleft{display:block;background:url(images/prev.gif) no-repeat -4px center;width:24px;height:24px;position:relative;top:-24px;margin-bottom:-24px;z-index:3} .flexigrid div.hDiv span.cdropright{display:block;background:url(images/next.gif) no-repeat 12px center;width:24px;height:24px;float:right;position:relative;top:-24px;margin-bottom:-24px} .flexigrid div.bDiv td div{border-top:0 solid #fff;padding-bottom:4px} .flexigrid tr td.sorted{background:#f3f3f3;border-right:1px solid #ddd;border-bottom:1px solid #f3f3f3} .flexigrid tr.erow td{background:#f7f7f7;border-bottom:1px solid #f7f7f7} .flexigrid tr.erow td.sorted{background:#e3e3e3;border-bottom:1px solid #e3e3e3} .flexigrid div.bDiv tr:hover td,.flexigrid div.bDiv tr:hover td.sorted,.flexigrid div.bDiv tr.trOver td.sorted,.flexigrid div.bDiv tr.trOver td{background:#d9ebf5;border-left:1px solid #eef8ff;border-bottom:1px dotted #a8d8eb} .flexigrid div.bDiv tr.trSelected:hover td,.flexigrid div.bDiv tr.trSelected:hover td.sorted,.flexigrid div.bDiv tr.trOver.trSelected td.sorted,.flexigrid div.bDiv tr.trOver.trSelected td,.flexigrid tr.trSelected td.sorted,.flexigrid tr.trSelected td{background:#d5effc url(images/hl.png) repeat-x top;border-right:1px solid #d2e3ec;border-left:1px solid #eef8ff;border-bottom:1px solid #a8d8eb} .flexigrid.novstripe .bDiv table{border-bottom:1px solid #ccc;border-right:1px solid #ccc} .flexigrid.novstripe div.bDiv td{border-right-color:#fff} .flexigrid.novstripe div.bDiv tr.erow td.sorted{border-right-color:#e3e3e3} .flexigrid.novstripe div.bDiv tr td.sorted{border-right-color:#f3f3f3} .flexigrid.novstripe div.bDiv tr.erow td{border-right-color:#f7f7f7;border-left-color:#f7f7f7} .flexigrid.novstripe div.bDiv tr.trSelected:hover td,.flexigrid.novstripe div.bDiv tr.trSelected:hover td.sorted,.flexigrid.novstripe div.bDiv tr.trOver.trSelected td.sorted,.flexigrid.novstripe div.bDiv tr.trOver.trSelected td,.flexigrid.novstripe tr.trSelected td.sorted,.flexigrid.novstripe tr.trSelected td{border-right:1px solid #06F;border-left:1px solid #06F} .flexigrid.novstripe div.bDiv tr.trOver td,.flexigrid.novstripe div.bDiv tr:hover td{border-left-color:#d9ebf5;border-right-color:#d9ebf5} .flexigrid div.pDiv{background:url(images/wbg.gif) repeat-x 0 -1px;border:1px solid #ccc;border-top:0;overflow:hidden;white-space:nowrap;position:relative} .flexigrid div.pDiv div.pDiv2{float:left;width:1024px;margin:3px 3px 3px -2px} div.pGroup{float:left;background:none;height:24px;margin:0 5px} .flexigrid div.pDiv .pPageStat,.flexigrid div.pDiv .pcontrol{position:relative;top:5px;overflow:visible} .flexigrid div.pDiv input{vertical-align:text-top;position:relative;top:-5px} .flexigrid div.pDiv div.pButton{float:left;width:22px;height:22px;border:0;cursor:pointer;overflow:hidden} .flexigrid div.pDiv div.pButton:hover,.flexigrid div.pDiv div.pButton.pBtnOver{width:20px;height:20px;border:1px solid #ccc;cursor:pointer} .flexigrid div.pDiv div.pButton span{width:20px;height:20px;display:block;float:left} .flexigrid div.pDiv div.pButton:hover span,.flexigrid div.pDiv div.pButton.pBtnOver span{width:19px;height:19px;border-top:1px solid #fff;border-left:1px solid #fff} .flexigrid .pSearch{background:url(images/magnifier.png) no-repeat center} .flexigrid .pFirst{background:url(images/first.gif) no-repeat center} .flexigrid .pPrev{background:url(images/prev.gif) no-repeat center} .flexigrid .pNext{background:url(images/next.gif) no-repeat center} .flexigrid .pLast{background:url(images/last.gif) no-repeat center} .flexigrid .pReload{background:url(images/load.png) no-repeat center} .flexigrid .pReload.loading{background:url(images/load.gif) no-repeat center} .flexigrid.ie div.hDiv th div,.flexigrid.ie div.bDiv td div,div.colCopy.ie div /* common inner cell properties*/{overflow:hidden} ================================================ FILE: demo/conflict-test.html ================================================ Testing Flexigrid + Prototype
Col 1 Col 2 Col 3 is a long header name Col 4
This is data 1 with overflowing content This is data 2 This is data 3 This is data 4
This is data 1 This is data 2 This is data 3 This is data 4
================================================ FILE: demo/countryArray.inc.php ================================================ 'AF', 'name'=>'Afghanistan', 'iso3'=>'AFG', 'numcode'=>'4', ), array('iso'=>'AL', 'name'=>'Albania', 'iso3'=>'ALB', 'numcode'=>'8', ), array('iso'=>'DZ', 'name'=>'Algeria', 'iso3'=>'DZA', 'numcode'=>'12', ), array('iso'=>'AS', 'name'=>'American Samoa', 'iso3'=>'ASM', 'numcode'=>'16', ), array('iso'=>'AD', 'name'=>'Andorra', 'iso3'=>'AND', 'numcode'=>'20', ), array('iso'=>'AO', 'name'=>'Angola', 'iso3'=>'AGO', 'numcode'=>'24', ), array('iso'=>'AI', 'name'=>'Anguilla', 'iso3'=>'AIA', 'numcode'=>'660', ), array('iso'=>'AQ', 'name'=>'Antarctica', 'iso3'=>'ART', 'numcode'=>'0', ), array('iso'=>'AG', 'name'=>'Antigua and Barbuda', 'iso3'=>'ATG', 'numcode'=>'28', ), array('iso'=>'AR', 'name'=>'Argentina', 'iso3'=>'ARG', 'numcode'=>'32', ), array('iso'=>'AM', 'name'=>'Armenia', 'iso3'=>'ARM', 'numcode'=>'51', ), array('iso'=>'AW', 'name'=>'Aruba', 'iso3'=>'ABW', 'numcode'=>'533', ), array('iso'=>'AU', 'name'=>'Australia', 'iso3'=>'AUS', 'numcode'=>'36', ), array('iso'=>'AT', 'name'=>'Austria', 'iso3'=>'AUT', 'numcode'=>'40', ), array('iso'=>'AZ', 'name'=>'Azerbaijan', 'iso3'=>'AZE', 'numcode'=>'31', ), array('iso'=>'BS', 'name'=>'Bahamas', 'iso3'=>'BHS', 'numcode'=>'44', ), array('iso'=>'BH', 'name'=>'Bahrain', 'iso3'=>'BHR', 'numcode'=>'48', ), array('iso'=>'BD', 'name'=>'Bangladesh', 'iso3'=>'BGD', 'numcode'=>'50', ), array('iso'=>'BB', 'name'=>'Barbados', 'iso3'=>'BRB', 'numcode'=>'52', ), array('iso'=>'BY', 'name'=>'Belarus', 'iso3'=>'BLR', 'numcode'=>'112', ), array('iso'=>'BE', 'name'=>'Belgium', 'iso3'=>'BEL', 'numcode'=>'56', ), array('iso'=>'BZ', 'name'=>'Belize', 'iso3'=>'BLZ', 'numcode'=>'84', ), array('iso'=>'BJ', 'name'=>'Benin', 'iso3'=>'BEN', 'numcode'=>'204', ), array('iso'=>'BM', 'name'=>'Bermuda', 'iso3'=>'BMU', 'numcode'=>'60', ), array('iso'=>'BT', 'name'=>'Bhutan', 'iso3'=>'BTN', 'numcode'=>'64', ), array('iso'=>'BO', 'name'=>'Bolivia', 'iso3'=>'BOL', 'numcode'=>'68', ), array('iso'=>'BA', 'name'=>'Bosnia and Herzegovina', 'iso3'=>'BIH', 'numcode'=>'70', ), array('iso'=>'BW', 'name'=>'Botswana', 'iso3'=>'BWA', 'numcode'=>'72', ), array('iso'=>'BV', 'name'=>'Bouvet Island', 'iso3'=>'BVT', 'numcode'=>'0', ), array('iso'=>'BR', 'name'=>'Brazil', 'iso3'=>'BRA', 'numcode'=>'76', ), array('iso'=>'IO', 'name'=>'British Indian Ocean Territory', 'iso3'=>'BIO', 'numcode'=>'0', ), array('iso'=>'BN', 'name'=>'Brunei Darussalam', 'iso3'=>'BRN', 'numcode'=>'96', ), array('iso'=>'BG', 'name'=>'Bulgaria', 'iso3'=>'BGR', 'numcode'=>'100', ), array('iso'=>'BF', 'name'=>'Burkina Faso', 'iso3'=>'BFA', 'numcode'=>'854', ), array('iso'=>'BI', 'name'=>'Burundi', 'iso3'=>'BDI', 'numcode'=>'108', ), array('iso'=>'KH', 'name'=>'Cambodia', 'iso3'=>'KHM', 'numcode'=>'116', ), array('iso'=>'CM', 'name'=>'Cameroon', 'iso3'=>'CMR', 'numcode'=>'120', ), array('iso'=>'CA', 'name'=>'Canada', 'iso3'=>'CAN', 'numcode'=>'124', ), array('iso'=>'CV', 'name'=>'Cape Verde', 'iso3'=>'CPV', 'numcode'=>'132', ), array('iso'=>'KY', 'name'=>'Cayman Islands', 'iso3'=>'CYM', 'numcode'=>'136', ), array('iso'=>'CF', 'name'=>'Central African Republic', 'iso3'=>'CAF', 'numcode'=>'140', ), array('iso'=>'TD', 'name'=>'Chad', 'iso3'=>'TCD', 'numcode'=>'148', ), array('iso'=>'CL', 'name'=>'Chile', 'iso3'=>'CHL', 'numcode'=>'152', ), array('iso'=>'CN', 'name'=>'China', 'iso3'=>'CHN', 'numcode'=>'156', ), array('iso'=>'CX', 'name'=>'Christmas Island', 'iso3'=>'CMI', 'numcode'=>'0', ), array('iso'=>'CC', 'name'=>'Cocos (Keeling) Islands', 'iso3'=>'CKI', 'numcode'=>'0', ), array('iso'=>'CO', 'name'=>'Colombia', 'iso3'=>'COL', 'numcode'=>'170', ), array('iso'=>'KM', 'name'=>'Comoros', 'iso3'=>'COM', 'numcode'=>'174', ), array('iso'=>'CG', 'name'=>'Congo', 'iso3'=>'COG', 'numcode'=>'178', ), array('iso'=>'CD', 'name'=>'Congo, the Democratic Republic of the', 'iso3'=>'COD', 'numcode'=>'180', ), array('iso'=>'CK', 'name'=>'Cook Islands', 'iso3'=>'COK', 'numcode'=>'184', ), array('iso'=>'CR', 'name'=>'Costa Rica', 'iso3'=>'CRI', 'numcode'=>'188', ), array('iso'=>'CI', 'name'=>'Cote D\'Ivoire', 'iso3'=>'CIV', 'numcode'=>'384', ), array('iso'=>'HR', 'name'=>'Croatia', 'iso3'=>'HRV', 'numcode'=>'191', ), array('iso'=>'CU', 'name'=>'Cuba', 'iso3'=>'CUB', 'numcode'=>'192', ), array('iso'=>'CY', 'name'=>'Cyprus', 'iso3'=>'CYP', 'numcode'=>'196', ), array('iso'=>'CZ', 'name'=>'Czech Republic', 'iso3'=>'CZE', 'numcode'=>'203', ), array('iso'=>'DK', 'name'=>'Denmark', 'iso3'=>'DNK', 'numcode'=>'208', ), array('iso'=>'DJ', 'name'=>'Djibouti', 'iso3'=>'DJI', 'numcode'=>'262', ), array('iso'=>'DM', 'name'=>'Dominica', 'iso3'=>'DMA', 'numcode'=>'212', ), array('iso'=>'DO', 'name'=>'Dominican Republic', 'iso3'=>'DOM', 'numcode'=>'214', ), array('iso'=>'EC', 'name'=>'Ecuador', 'iso3'=>'ECU', 'numcode'=>'218', ), array('iso'=>'EG', 'name'=>'Egypt', 'iso3'=>'EGY', 'numcode'=>'818', ), array('iso'=>'SV', 'name'=>'El Salvador', 'iso3'=>'SLV', 'numcode'=>'222', ), array('iso'=>'GQ', 'name'=>'Equatorial Guinea', 'iso3'=>'GNQ', 'numcode'=>'226', ), array('iso'=>'ER', 'name'=>'Eritrea', 'iso3'=>'ERI', 'numcode'=>'232', ), array('iso'=>'EE', 'name'=>'Estonia', 'iso3'=>'EST', 'numcode'=>'233', ), array('iso'=>'ET', 'name'=>'Ethiopia', 'iso3'=>'ETH', 'numcode'=>'231', ), array('iso'=>'FK', 'name'=>'Falkland Islands (Malvinas)', 'iso3'=>'FLK', 'numcode'=>'238', ), array('iso'=>'FO', 'name'=>'Faroe Islands', 'iso3'=>'FRO', 'numcode'=>'234', ), array('iso'=>'FJ', 'name'=>'Fiji', 'iso3'=>'FJI', 'numcode'=>'242', ), array('iso'=>'FI', 'name'=>'Finland', 'iso3'=>'FIN', 'numcode'=>'246', ), array('iso'=>'FR', 'name'=>'France', 'iso3'=>'FRA', 'numcode'=>'250', ), array('iso'=>'GF', 'name'=>'French Guiana', 'iso3'=>'GUF', 'numcode'=>'254', ), array('iso'=>'PF', 'name'=>'French Polynesia', 'iso3'=>'PYF', 'numcode'=>'258', ), array('iso'=>'TF', 'name'=>'French Southern Territories', 'iso3'=>'FST', 'numcode'=>'0', ), array('iso'=>'GA', 'name'=>'Gabon', 'iso3'=>'GAB', 'numcode'=>'266', ), array('iso'=>'GM', 'name'=>'Gambia', 'iso3'=>'GMB', 'numcode'=>'270', ), array('iso'=>'GE', 'name'=>'Georgia', 'iso3'=>'GEO', 'numcode'=>'268', ), array('iso'=>'DE', 'name'=>'Germany', 'iso3'=>'DEU', 'numcode'=>'276', ), array('iso'=>'GH', 'name'=>'Ghana', 'iso3'=>'GHA', 'numcode'=>'288', ), array('iso'=>'GI', 'name'=>'Gibraltar', 'iso3'=>'GIB', 'numcode'=>'292', ), array('iso'=>'GR', 'name'=>'Greece', 'iso3'=>'GRC', 'numcode'=>'300', ), array('iso'=>'GL', 'name'=>'Greenland', 'iso3'=>'GRL', 'numcode'=>'304', ), array('iso'=>'GD', 'name'=>'Grenada', 'iso3'=>'GRD', 'numcode'=>'308', ), array('iso'=>'GP', 'name'=>'Guadeloupe', 'iso3'=>'GLP', 'numcode'=>'312', ), array('iso'=>'GU', 'name'=>'Guam', 'iso3'=>'GUM', 'numcode'=>'316', ), array('iso'=>'GT', 'name'=>'Guatemala', 'iso3'=>'GTM', 'numcode'=>'320', ), array('iso'=>'GN', 'name'=>'Guinea', 'iso3'=>'GIN', 'numcode'=>'324', ), array('iso'=>'GW', 'name'=>'Guinea-Bissau', 'iso3'=>'GNB', 'numcode'=>'624', ), array('iso'=>'GY', 'name'=>'Guyana', 'iso3'=>'GUY', 'numcode'=>'328', ), array('iso'=>'HT', 'name'=>'Haiti', 'iso3'=>'HTI', 'numcode'=>'332', ), array('iso'=>'HM', 'name'=>'Heard Island and Mcdonald Islands', 'iso3'=>'HMI', 'numcode'=>'0', ), array('iso'=>'VA', 'name'=>'Holy See (Vatican City State)', 'iso3'=>'VAT', 'numcode'=>'336', ), array('iso'=>'HN', 'name'=>'Honduras', 'iso3'=>'HND', 'numcode'=>'340', ), array('iso'=>'HK', 'name'=>'Hong Kong', 'iso3'=>'HKG', 'numcode'=>'344', ), array('iso'=>'HU', 'name'=>'Hungary', 'iso3'=>'HUN', 'numcode'=>'348', ), array('iso'=>'IS', 'name'=>'Iceland', 'iso3'=>'ISL', 'numcode'=>'352', ), array('iso'=>'IN', 'name'=>'India', 'iso3'=>'IND', 'numcode'=>'356', ), array('iso'=>'ID', 'name'=>'Indonesia', 'iso3'=>'IDN', 'numcode'=>'360', ), array('iso'=>'IR', 'name'=>'Iran, Islamic Republic of', 'iso3'=>'IRN', 'numcode'=>'364', ), array('iso'=>'IQ', 'name'=>'Iraq', 'iso3'=>'IRQ', 'numcode'=>'368', ), array('iso'=>'IE', 'name'=>'Ireland', 'iso3'=>'IRL', 'numcode'=>'372', ), array('iso'=>'IL', 'name'=>'Israel', 'iso3'=>'ISR', 'numcode'=>'376', ), array('iso'=>'IT', 'name'=>'Italy', 'iso3'=>'ITA', 'numcode'=>'380', ), array('iso'=>'JM', 'name'=>'Jamaica', 'iso3'=>'JAM', 'numcode'=>'388', ), array('iso'=>'JP', 'name'=>'Japan', 'iso3'=>'JPN', 'numcode'=>'392', ), array('iso'=>'JO', 'name'=>'Jordan', 'iso3'=>'JOR', 'numcode'=>'400', ), array('iso'=>'KZ', 'name'=>'Kazakhstan', 'iso3'=>'KAZ', 'numcode'=>'398', ), array('iso'=>'KE', 'name'=>'Kenya', 'iso3'=>'KEN', 'numcode'=>'404', ), array('iso'=>'KI', 'name'=>'Kiribati', 'iso3'=>'KIR', 'numcode'=>'296', ), array('iso'=>'KP', 'name'=>'Korea, Democratic People\'s Republic of', 'iso3'=>'PRK', 'numcode'=>'408', ), array('iso'=>'KR', 'name'=>'Korea, Republic of', 'iso3'=>'KOR', 'numcode'=>'410', ), array('iso'=>'KW', 'name'=>'Kuwait', 'iso3'=>'KWT', 'numcode'=>'414', ), array('iso'=>'KG', 'name'=>'Kyrgyzstan', 'iso3'=>'KGZ', 'numcode'=>'417', ), array('iso'=>'LA', 'name'=>'Lao People\'s Democratic Republic', 'iso3'=>'LAO', 'numcode'=>'418', ), array('iso'=>'LV', 'name'=>'Latvia', 'iso3'=>'LVA', 'numcode'=>'428', ), array('iso'=>'LB', 'name'=>'Lebanon', 'iso3'=>'LBN', 'numcode'=>'422', ), array('iso'=>'LS', 'name'=>'Lesotho', 'iso3'=>'LSO', 'numcode'=>'426', ), array('iso'=>'LR', 'name'=>'Liberia', 'iso3'=>'LBR', 'numcode'=>'430', ), array('iso'=>'LY', 'name'=>'Libyan Arab Jamahiriya', 'iso3'=>'LBY', 'numcode'=>'434', ), array('iso'=>'LI', 'name'=>'Liechtenstein', 'iso3'=>'LIE', 'numcode'=>'438', ), array('iso'=>'LT', 'name'=>'Lithuania', 'iso3'=>'LTU', 'numcode'=>'440', ), array('iso'=>'LU', 'name'=>'Luxembourg', 'iso3'=>'LUX', 'numcode'=>'442', ), array('iso'=>'MO', 'name'=>'Macao', 'iso3'=>'MAC', 'numcode'=>'446', ), array('iso'=>'MK', 'name'=>'Macedonia, the Former Yugoslav Republic of', 'iso3'=>'MKD', 'numcode'=>'807', ), array('iso'=>'MG', 'name'=>'Madagascar', 'iso3'=>'MDG', 'numcode'=>'450', ), array('iso'=>'MW', 'name'=>'Malawi', 'iso3'=>'MWI', 'numcode'=>'454', ), array('iso'=>'MY', 'name'=>'Malaysia', 'iso3'=>'MYS', 'numcode'=>'458', ), array('iso'=>'MV', 'name'=>'Maldives', 'iso3'=>'MDV', 'numcode'=>'462', ), array('iso'=>'ML', 'name'=>'Mali', 'iso3'=>'MLI', 'numcode'=>'466', ), array('iso'=>'MT', 'name'=>'Malta', 'iso3'=>'MLT', 'numcode'=>'470', ), array('iso'=>'MH', 'name'=>'Marshall Islands', 'iso3'=>'MHL', 'numcode'=>'584', ), array('iso'=>'MQ', 'name'=>'Martinique', 'iso3'=>'MTQ', 'numcode'=>'474', ), array('iso'=>'MR', 'name'=>'Mauritania', 'iso3'=>'MRT', 'numcode'=>'478', ), array('iso'=>'MU', 'name'=>'Mauritius', 'iso3'=>'MUS', 'numcode'=>'480', ), array('iso'=>'YT', 'name'=>'Mayotte', 'iso3'=>'MAY', 'numcode'=>'0', ), array('iso'=>'MX', 'name'=>'Mexico', 'iso3'=>'MEX', 'numcode'=>'484', ), array('iso'=>'FM', 'name'=>'Micronesia, Federated States of', 'iso3'=>'FSM', 'numcode'=>'583', ), array('iso'=>'MD', 'name'=>'Moldova, Republic of', 'iso3'=>'MDA', 'numcode'=>'498', ), array('iso'=>'MC', 'name'=>'Monaco', 'iso3'=>'MCO', 'numcode'=>'492', ), array('iso'=>'MN', 'name'=>'Mongolia', 'iso3'=>'MNG', 'numcode'=>'496', ), array('iso'=>'MS', 'name'=>'Montserrat', 'iso3'=>'MSR', 'numcode'=>'500', ), array('iso'=>'MA', 'name'=>'Morocco', 'iso3'=>'MAR', 'numcode'=>'504', ), array('iso'=>'MZ', 'name'=>'Mozambique', 'iso3'=>'MOZ', 'numcode'=>'508', ), array('iso'=>'MM', 'name'=>'Myanmar', 'iso3'=>'MMR', 'numcode'=>'104', ), array('iso'=>'NA', 'name'=>'Namibia', 'iso3'=>'NAM', 'numcode'=>'516', ), array('iso'=>'NR', 'name'=>'Nauru', 'iso3'=>'NRU', 'numcode'=>'520', ), array('iso'=>'NP', 'name'=>'Nepal', 'iso3'=>'NPL', 'numcode'=>'524', ), array('iso'=>'NL', 'name'=>'Netherlands', 'iso3'=>'NLD', 'numcode'=>'528', ), array('iso'=>'AN', 'name'=>'Netherlands Antilles', 'iso3'=>'ANT', 'numcode'=>'530', ), array('iso'=>'NC', 'name'=>'New Caledonia', 'iso3'=>'NCL', 'numcode'=>'540', ), array('iso'=>'NZ', 'name'=>'New Zealand', 'iso3'=>'NZL', 'numcode'=>'554', ), array('iso'=>'NI', 'name'=>'Nicaragua', 'iso3'=>'NIC', 'numcode'=>'558', ), array('iso'=>'NE', 'name'=>'Niger', 'iso3'=>'NER', 'numcode'=>'562', ), array('iso'=>'NG', 'name'=>'Nigeria', 'iso3'=>'NGA', 'numcode'=>'566', ), array('iso'=>'NU', 'name'=>'Niue', 'iso3'=>'NIU', 'numcode'=>'570', ), array('iso'=>'NF', 'name'=>'Norfolk Island', 'iso3'=>'NFK', 'numcode'=>'574', ), array('iso'=>'MP', 'name'=>'Northern Mariana Islands', 'iso3'=>'MNP', 'numcode'=>'580', ), array('iso'=>'NO', 'name'=>'Norway', 'iso3'=>'NOR', 'numcode'=>'578', ), array('iso'=>'OM', 'name'=>'Oman', 'iso3'=>'OMN', 'numcode'=>'512', ), array('iso'=>'PK', 'name'=>'Pakistan', 'iso3'=>'PAK', 'numcode'=>'586', ), array('iso'=>'PW', 'name'=>'Palau', 'iso3'=>'PLW', 'numcode'=>'585', ), array('iso'=>'PS', 'name'=>'Palestinian Territory, Occupied', 'iso3'=>'PTO', 'numcode'=>'0', ), array('iso'=>'PA', 'name'=>'Panama', 'iso3'=>'PAN', 'numcode'=>'591', ), array('iso'=>'PG', 'name'=>'Papua New Guinea', 'iso3'=>'PNG', 'numcode'=>'598', ), array('iso'=>'PY', 'name'=>'Paraguay', 'iso3'=>'PRY', 'numcode'=>'600', ), array('iso'=>'PE', 'name'=>'Peru', 'iso3'=>'PER', 'numcode'=>'604', ), array('iso'=>'PH', 'name'=>'Philippines', 'iso3'=>'PHL', 'numcode'=>'608', ), array('iso'=>'PN', 'name'=>'Pitcairn', 'iso3'=>'PCN', 'numcode'=>'612', ), array('iso'=>'PL', 'name'=>'Poland', 'iso3'=>'POL', 'numcode'=>'616', ), array('iso'=>'PT', 'name'=>'Portugal', 'iso3'=>'PRT', 'numcode'=>'620', ), array('iso'=>'PR', 'name'=>'Puerto Rico', 'iso3'=>'PRI', 'numcode'=>'630', ), array('iso'=>'QA', 'name'=>'Qatar', 'iso3'=>'QAT', 'numcode'=>'634', ), array('iso'=>'RE', 'name'=>'Reunion', 'iso3'=>'REU', 'numcode'=>'638', ), array('iso'=>'RO', 'name'=>'Romania', 'iso3'=>'ROM', 'numcode'=>'642', ), array('iso'=>'RU', 'name'=>'Russian Federation', 'iso3'=>'RUS', 'numcode'=>'643', ), array('iso'=>'RW', 'name'=>'Rwanda', 'iso3'=>'RWA', 'numcode'=>'646', ), array('iso'=>'SH', 'name'=>'Saint Helena', 'iso3'=>'SHN', 'numcode'=>'654', ), array('iso'=>'KN', 'name'=>'Saint Kitts and Nevis', 'iso3'=>'KNA', 'numcode'=>'659', ), array('iso'=>'LC', 'name'=>'Saint Lucia', 'iso3'=>'LCA', 'numcode'=>'662', ), array('iso'=>'PM', 'name'=>'Saint Pierre and Miquelon', 'iso3'=>'SPM', 'numcode'=>'666', ), array('iso'=>'VC', 'name'=>'Saint Vincent and the Grenadines', 'iso3'=>'VCT', 'numcode'=>'670', ), array('iso'=>'WS', 'name'=>'Samoa', 'iso3'=>'WSM', 'numcode'=>'882', ), array('iso'=>'SM', 'name'=>'San Marino', 'iso3'=>'SMR', 'numcode'=>'674', ), array('iso'=>'ST', 'name'=>'Sao Tome and Principe', 'iso3'=>'STP', 'numcode'=>'678', ), array('iso'=>'SA', 'name'=>'Saudi Arabia', 'iso3'=>'SAU', 'numcode'=>'682', ), array('iso'=>'SN', 'name'=>'Senegal', 'iso3'=>'SEN', 'numcode'=>'686', ), array('iso'=>'CS', 'name'=>'Serbia and Montenegro', 'iso3'=>'SNM', 'numcode'=>'0', ), array('iso'=>'SC', 'name'=>'Seychelles', 'iso3'=>'SYC', 'numcode'=>'690', ), array('iso'=>'SL', 'name'=>'Sierra Leone', 'iso3'=>'SLE', 'numcode'=>'694', ), array('iso'=>'SG', 'name'=>'Singapore', 'iso3'=>'SGP', 'numcode'=>'702', ), array('iso'=>'SK', 'name'=>'Slovakia', 'iso3'=>'SVK', 'numcode'=>'703', ), array('iso'=>'SI', 'name'=>'Slovenia', 'iso3'=>'SVN', 'numcode'=>'705', ), array('iso'=>'SB', 'name'=>'Solomon Islands', 'iso3'=>'SLB', 'numcode'=>'90', ), array('iso'=>'SO', 'name'=>'Somalia', 'iso3'=>'SOM', 'numcode'=>'706', ), array('iso'=>'ZA', 'name'=>'South Africa', 'iso3'=>'ZAF', 'numcode'=>'710', ), array('iso'=>'GS', 'name'=>'South Georgia and the South Sandwich Islands', 'iso3'=>'SGS', 'numcode'=>'0', ), array('iso'=>'ES', 'name'=>'Spain', 'iso3'=>'ESP', 'numcode'=>'724', ), array('iso'=>'LK', 'name'=>'Sri Lanka', 'iso3'=>'LKA', 'numcode'=>'144', ), array('iso'=>'SD', 'name'=>'Sudan', 'iso3'=>'SDN', 'numcode'=>'736', ), array('iso'=>'SR', 'name'=>'Suriname', 'iso3'=>'SUR', 'numcode'=>'740', ), array('iso'=>'SJ', 'name'=>'Svalbard and Jan Mayen', 'iso3'=>'SJM', 'numcode'=>'744', ), array('iso'=>'SZ', 'name'=>'Swaziland', 'iso3'=>'SWZ', 'numcode'=>'748', ), array('iso'=>'SE', 'name'=>'Sweden', 'iso3'=>'SWE', 'numcode'=>'752', ), array('iso'=>'CH', 'name'=>'Switzerland', 'iso3'=>'CHE', 'numcode'=>'756', ), array('iso'=>'SY', 'name'=>'Syrian Arab Republic', 'iso3'=>'SYR', 'numcode'=>'760', ), array('iso'=>'TW', 'name'=>'Taiwan, Province of China', 'iso3'=>'TWN', 'numcode'=>'158', ), array('iso'=>'TJ', 'name'=>'Tajikistan', 'iso3'=>'TJK', 'numcode'=>'762', ), array('iso'=>'TZ', 'name'=>'Tanzania, United Republic of', 'iso3'=>'TZA', 'numcode'=>'834', ), array('iso'=>'TH', 'name'=>'Thailand', 'iso3'=>'THA', 'numcode'=>'764', ), array('iso'=>'TL', 'name'=>'Timor-Leste', 'iso3'=>'TIM', 'numcode'=>'0', ), array('iso'=>'TG', 'name'=>'Togo', 'iso3'=>'TGO', 'numcode'=>'768', ), array('iso'=>'TK', 'name'=>'Tokelau', 'iso3'=>'TKL', 'numcode'=>'772', ), array('iso'=>'TO', 'name'=>'Tonga', 'iso3'=>'TON', 'numcode'=>'776', ), array('iso'=>'TT', 'name'=>'Trinidad and Tobago', 'iso3'=>'TTO', 'numcode'=>'780', ), array('iso'=>'TN', 'name'=>'Tunisia', 'iso3'=>'TUN', 'numcode'=>'788', ), array('iso'=>'TR', 'name'=>'Turkey', 'iso3'=>'TUR', 'numcode'=>'792', ), array('iso'=>'TM', 'name'=>'Turkmenistan', 'iso3'=>'TKM', 'numcode'=>'795', ), array('iso'=>'TC', 'name'=>'Turks and Caicos Islands', 'iso3'=>'TCA', 'numcode'=>'796', ), array('iso'=>'TV', 'name'=>'Tuvalu', 'iso3'=>'TUV', 'numcode'=>'798', ), array('iso'=>'UG', 'name'=>'Uganda', 'iso3'=>'UGA', 'numcode'=>'800', ), array('iso'=>'UA', 'name'=>'Ukraine', 'iso3'=>'UKR', 'numcode'=>'804', ), array('iso'=>'AE', 'name'=>'United Arab Emirates', 'iso3'=>'ARE', 'numcode'=>'784', ), array('iso'=>'GB', 'name'=>'United Kingdom', 'iso3'=>'GBR', 'numcode'=>'826', ), array('iso'=>'US', 'name'=>'United States', 'iso3'=>'USA', 'numcode'=>'840', ), array('iso'=>'UM', 'name'=>'United States Minor Outlying Islands', 'iso3'=>'USI', 'numcode'=>'0', ), array('iso'=>'UY', 'name'=>'Uruguay', 'iso3'=>'URY', 'numcode'=>'858', ), array('iso'=>'UZ', 'name'=>'Uzbekistan', 'iso3'=>'UZB', 'numcode'=>'860', ), array('iso'=>'VU', 'name'=>'Vanuatu', 'iso3'=>'VUT', 'numcode'=>'548', ), array('iso'=>'VE', 'name'=>'Venezuela', 'iso3'=>'VEN', 'numcode'=>'862', ), array('iso'=>'VN', 'name'=>'Viet Nam', 'iso3'=>'VNM', 'numcode'=>'704', ), array('iso'=>'VG', 'name'=>'Virgin Islands, British', 'iso3'=>'VGB', 'numcode'=>'92', ), array('iso'=>'VI', 'name'=>'Virgin Islands, U.s.', 'iso3'=>'VIR', 'numcode'=>'850', ), array('iso'=>'WF', 'name'=>'Wallis and Futuna', 'iso3'=>'WLF', 'numcode'=>'876', ), array('iso'=>'EH', 'name'=>'Western Sahara', 'iso3'=>'ESH', 'numcode'=>'732', ), array('iso'=>'YE', 'name'=>'Yemen', 'iso3'=>'YEM', 'numcode'=>'887', ), array('iso'=>'ZM', 'name'=>'Zambia', 'iso3'=>'ZMB', 'numcode'=>'894', ), array('iso'=>'ZW', 'name'=>'Zimbabwe', 'iso3'=>'ZWE', 'numcode'=>'716', ) ); //Quick hack to add the printable name column foreach($rows AS $key => $row){ $rows[$key]['printable_name'] = $row['name']; } ================================================ FILE: demo/example4.php ================================================ $_GET['Name'] , 'favorite_color'=>$_GET['FavoriteColor'] , 'favorite_pet'=>$_GET['FavoritePet'] , 'primary_language'=>$_GET['PrimaryLanguage'] ); $_SESSION['Example4'] = $rows; } elseif(isset($_GET['Edit'])){ // this is for Editing records $rows = $_SESSION['Example4']; unset($rows[trim($_GET['OrgEmpID'])]); // just delete the original entry and add. $rows[$_GET['EmpID']] = array( 'name'=>$_GET['Name'] , 'favorite_color'=>$_GET['FavoriteColor'] , 'favorite_pet'=>$_GET['FavoritePet'] , 'primary_language'=>$_GET['PrimaryLanguage'] ); $_SESSION['Example4'] = $rows; } elseif(isset($_GET['Delete'])){ // this is for removing records $rows = $_SESSION['Example4']; unset($rows[trim($_GET['Delete'])]); // to remove the \n $_SESSION['Example4'] = $rows; } else{ if(isset($_SESSION['Example4'])){ // get session if there is one $rows = $_SESSION['Example4']; } else{ // create session with some data if there isn't $rows[1] = array('name'=>'Tony', 'favorite_color'=>'green', 'favorite_pet'=>'hamster', 'primary_language'=>'english'); $rows[2] = array('name'=>'Mary', 'favorite_color'=>'red', 'favorite_pet'=>'groundhog', 'primary_language'=>'spanish'); $rows[3] = array('name'=>'Seth', 'favorite_color'=>'silver', 'favorite_pet'=>'snake', 'primary_language'=>'french'); $rows[4] = array('name'=>'Sandra', 'favorite_color'=>'blue', 'favorite_pet'=>'cat', 'primary_language'=>'mandarin'); $_SESSION['Example4'] = $rows; } header("Content-type: application/json"); $jsonData = array('page'=>$page,'total'=>0,'rows'=>array()); foreach($rows AS $rowNum => $row){ //If cell's elements have named keys, they must match column names //Only cell's with named keys and matching columns are order independent. $entry = array('id' => $rowNum, 'cell'=>array( 'employeeID' => $rowNum, 'name' => $row['name'], 'primary_language' => $row['primary_language'], 'favorite_color' => $row['favorite_color'], 'favorite_pet' => $row['favorite_pet'] ) ); $jsonData['rows'][] = $entry; } $jsonData['total'] = count($rows); echo json_encode($jsonData); } ================================================ FILE: demo/index.html ================================================ Flexigrid Flexigrid Download

Flexigrid for jQueryby Paulo P. Marinas

What is it?

Lightweight but rich data grid with resizable columns and a scrolling data to match the headers, plus an ability to connect to an xml based data source using Ajax to load the content.

Similar in concept with the Ext Grid only its pure jQuery love, which makes it light weight and follows the jQuery mantra of running with the least amount of configuration.

Features

FAQ

  1. Where can I get support?
    Bugs can be reported http://code.google.com/p/flexigrid/, and our fantastic community support is available at http://groups.google.com/group/flexigrid/.
  2. What's recently changed and what are the known bugs?
  3. What browsers does Flexigrid support?
    We support browsers IE6, Firefox 3, Opera 9, Safari 3, Chrome 7 and greater.
  4. Where can I contribute code or suggest a feature?
  5. Can I use it for personal or commercial projects/modify it/hack it?
    Absolutely! Just make sure you adhere to either the GPL or MIT licenses.
  6. Can I connect this to a form or add Parameters?
    Sure, check out our sample code to learn how.

Files you need

How to use

Check out the examples below, or browse the source.

Example 1

The most basic example with the zero configuration, with a table converted into flexigrid (Show sample code)

$('.flexme').flexigrid();
Col 1 Col 2 Col 3 is a long header name Col 4
This is data 1 with overflowing content This is data 2 This is data 3 This is data 4
This is data 1 This is data 2 This is data 3 This is data 4
This is data 1 This is data 2 This is data 3 This is data 4
This is data 1 This is data 2 This is data 3 This is data 4
This is data 1 This is data 2 This is data 3 This is data 4
This is data 1 This is data 2 This is data 3 This is data 4
This is data 1 This is data 2 This is data 3 This is data 4
This is data 1 This is data 2 This is data 3 This is data 4
This is data 1 This is data 2 This is data 3 This is data 4
This is data 1 This is data 2 This is data 3 This is data 4
This is data 1 This is data 2 This is data 3 This is data 4
This is data 1 This is data 2 This is data 3 This is data 4

Example 2

Table converted into flexigrid with height, and width set to auto, stripes remove. (Show sample code)

$('.flexme2').flexigrid({height:'auto',striped:false});
Col 1 Col 2 Col 3 is a long header name Col 4
This is data 1 with overflowing content This is data 2 This is data 3 This is data 4
This is data 1 This is data 2 This is data 3 This is data 4
This is data 1 This is data 2 This is data 3 This is data 4
This is data 1 This is data 2 This is data 3 This is data 4
This is data 1 This is data 2 This is data 3 This is data 4
This is data 1 This is data 2 This is data 3 This is data 4

Example 3

Flexigrid with dynamic data, paging, search, toolbar, and connected to an XML file. (Show sample code)

            $(".flexme3").flexigrid({
                url : 'post-xml.php',
                dataType : 'xml',
                colModel : [ {
                    display : 'ISO',
                    name : 'iso',
                    width : 40,
                    sortable : true,
                    align : 'center'
                    }, {
                        display : 'Name',
                        name : 'name',
                        width : 180,
                        sortable : true,
                        align : 'left'
                    }, {
                        display : 'Printable Name',
                        name : 'printable_name',
                        width : 120,
                        sortable : true,
                        align : 'left'
                    }, {
                        display : 'ISO3',
                        name : 'iso3',
                        width : 130,
                        sortable : true,
                        align : 'left',
                        hide : true
                    }, {
                        display : 'Number Code',
                        name : 'numcode',
                        width : 80,
                        sortable : true,
                        align : 'right'
                } ],
                buttons : [ {
                    name : 'Add',
                    bclass : 'add',
                    onpress : test
                    }, {
                        name : 'Delete',
                        bclass : 'delete',
                        onpress : test
                    }, {
                        separator : true
                } ],
                searchitems : [ {
                    display : 'ISO',
                    name : 'iso'
                    }, {
                        display : 'Name',
                        name : 'name',
                        isdefault : true
                } ],
                sortname : "iso",
                sortorder : "asc",
                usepager : true,
                title : 'Countries',
                useRp : true,
                rp : 15,
                showTableToggleBtn : true,
                width : 700,
                height : 200
            });      

            function test(com, grid) {
                if (com == 'Delete') {
                    confirm('Delete ' + $('.trSelected', grid).length + ' items?')
                } else if (com == 'Add') {
                    alert('Add New Item');
                }
            }
            

Example 4

Flexigrid with dynamic data, paging, search, toolbar, and connected to a php-session based JSON file. (Show sample code)

            $(".flexme4").flexigrid({
                url : 'example4.php',
                dataType : 'json',
                colModel : [ {
                    display : 'EmployeeID',
                    name : 'employeeID',
                    width : 90,
                    sortable : true,
                    align : 'center'
                    }, {
                        display : 'Name',
                        name : 'name',
                        width : 120,
                        sortable : true,
                        align : 'left'
                    }, {
                        display : 'Primary Language',
                        name : 'primary_language',
                        width : 120,
                        sortable : true,
                        align : 'left'
                    }, {
                        display : 'Favorite Color',
                        name : 'favorite_color',
                        width : 80,
                        sortable : true,
                        align : 'left',
                        hide : true
                    }, {
                        display : 'Favorite Animal',
                        name : 'favorite_pet',
                        width : 80,
                        sortable : true,
                        align : 'right'
                } ],
                buttons : [ {
                    name : 'Add',
                    bclass : 'add',
                    onpress : Example4
                    }
                    ,
                    {
                        name : 'Edit',
                        bclass : 'edit',
                        onpress : Example4
                    }
                    ,
                    {
                        name : 'Delete',
                        bclass : 'delete',
                        onpress : Example4
                    }
                    ,
                    {
                        separator : true
                    } 
                ],
                searchitems : [ {
                    display : 'EmployeeID',
                    name : 'employeeID'
                    }, {
                        display : 'Name',
                        name : 'name',
                        isdefault : true
                } ],
                sortname : "iso",
                sortorder : "asc",
                usepager : true,
                title : 'Employees',
                useRp : true,
                rp : 15,
                showTableToggleBtn : true,
                width : 750,
                height : 200
            });

            function Example4(com, grid) {
                if (com == 'Delete') {
                    var conf = confirm('Delete ' + $('.trSelected', grid).length + ' items?')
                    if(conf){
                        $.each($('.trSelected', grid),
                            function(key, value){
                                $.get('example4.php', { Delete: value.firstChild.innerText}
                                    , function(){
                                        // when ajax returns (callback), update the grid to refresh the data
                                        $(".flexme4").flexReload();
                                });
                        });    
                    }
                }
                else if (com == 'Edit') {
                    var conf = confirm('Edit ' + $('.trSelected', grid).length + ' items?')
                    if(conf){
                        $.each($('.trSelected', grid),
                            function(key, value){
                                // collect the data
                                var OrgEmpID = value.children[0].innerText; // in case we're changing the key
                                var EmpID = prompt("Please enter the New Employee ID",value.children[0].innerText);
                                var Name = prompt("Please enter the Employee Name",value.children[1].innerText);
                                var PrimaryLanguage = prompt("Please enter the Employee's Primary Language",value.children[2].innerText);
                                var FavoriteColor = prompt("Please enter the Employee's Favorite Color",value.children[3].innerText);
                                var FavoriteAnimal = prompt("Please enter the Employee's Favorite Animal",value.children[4].innerText);

                                // call the ajax to save the data to the session
                                $.get('example4.php', 
                                    { Edit: true
                                        , OrgEmpID: OrgEmpID
                                        , EmpID: EmpID
                                        , Name: Name
                                        , PrimaryLanguage: PrimaryLanguage
                                        , FavoriteColor: FavoriteColor
                                        , FavoritePet: FavoriteAnimal  }
                                    , function(){
                                        // when ajax returns (callback), update the grid to refresh the data
                                        $(".flexme4").flexReload();
                                });
                        });    
                    }
                }
                else if (com == 'Add') {
                    // collect the data
                    var EmpID = prompt("Please enter the Employee ID","5");
                    var Name = prompt("Please enter the Employee Name","Mark");
                    var PrimaryLanguage = prompt("Please enter the Employee's Primary Language","php");
                    var FavoriteColor = prompt("Please enter the Employee's Favorite Color","Tan");
                    var FavoriteAnimal = prompt("Please enter the Employee's Favorite Animal","Dog");

                    // call the ajax to save the data to the session
                    $.get('example4.php', { Add: true, EmpID: EmpID, Name: Name, PrimaryLanguage: PrimaryLanguage, FavoriteColor: FavoriteColor, FavoritePet: FavoriteAnimal  }
                        , function(){
                            // when ajax returns (callback), update the grid to refresh the data
                            $(".flexme4").flexReload();
                    });
                }
            }
            
================================================ FILE: demo/old-format.json ================================================ {"page":1,"total":239,"rows":[{"id":"ZW","cell":["ZW","Zimbabwe","Zimbabwe","ZWE","716"]},{"id":"ZM","cell":["ZM","Zambia","Zambia","ZMB","894"]},{"id":"YE","cell":["YE","Yemen","Yemen","YEM","887"]},{"id":"EH","cell":["EH","Western Sahara","Western Sahara","ESH","732"]},{"id":"WF","cell":["WF","Wallis and Futuna","Wallis and Futuna","WLF","876"]},{"id":"VI","cell":["VI","Virgin Islands, U.s.","Virgin Islands, U.s.","VIR","850"]},{"id":"VG","cell":["VG","Virgin Islands, British","Virgin Islands, British","VGB","92"]},{"id":"VN","cell":["VN","Viet Nam","Viet Nam","VNM","704"]},{"id":"VE","cell":["VE","Venezuela","Venezuela","VEN","862"]},{"id":"VU","cell":["VU","Vanuatu","Vanuatu","VUT","548"]}]} ================================================ FILE: demo/post-json.php ================================================ $row){ if(strpos(strtolower($row[$qtype]),$query) === false){ unset($rows[$key]); } } } //Make PHP handle the sorting $sortArray = array(); foreach($rows AS $key => $row){ $sortArray[$key] = $row[$sortname]; } $sortMethod = SORT_ASC; if($sortorder == 'desc'){ $sortMethod = SORT_DESC; } array_multisort($sortArray, $sortMethod, $rows); $total = count($rows); $rows = array_slice($rows,($page-1)*$rp,$rp); } header("Content-type: application/json"); $jsonData = array('page'=>$page,'total'=>$total,'rows'=>array()); foreach($rows AS $row){ //If cell's elements have named keys, they must match column names //Only cell's with named keys and matching columns are order independent. $entry = array('id'=>$row['iso'], 'cell'=>array( 'name'=>$row['name'], 'iso'=>$row['iso'], 'printable_name'=>$row['printable_name'], 'iso3'=>$row['iso3'], 'numcode'=>$row['numcode'] ), ); $jsonData['rows'][] = $entry; } echo json_encode($jsonData); ================================================ FILE: demo/post-xml.php ================================================ $row){ if(strpos(strtolower($row[$qtype]),$query) === false){ unset($rows[$key]); } } } //Make PHP handle the sorting $sortArray = array(); foreach($rows AS $key => $row){ $sortArray[$key] = $row[$sortname]; } $sortMethod = SORT_ASC; if($sortorder == 'desc'){ $sortMethod = SORT_DESC; } array_multisort($sortArray, $sortMethod, $rows); $total = count($rows); $rows = array_slice($rows,($page-1)*$rp,$rp); } header("Content-type: text/xml"); $xml = "\n"; $xml .= ""; $xml .= "$page"; $xml .= "$total"; foreach($rows AS $row){ $xml .= ""; $xml .= ""; $xml .= ""; //$xml .= ""; $xml .= ""; $xml .= ""; $xml .= ""; $xml .= ""; } $xml .= ""; echo $xml; ================================================ FILE: demo/sample.html ================================================ Flexigrid

This is a sample implementation attached to a form, to add additional parameters.

The values you entered will be place in name column for demo's sake.
Value 1 :
Value 2 : Is a hidden input with value 3
Value 3 :
Value 4 :

================================================ FILE: demo/style.css ================================================ @charset "utf-8"; /* http://meyerweb.com/eric/tools/css/reset/ v2.0 | 20110126 License: none (public domain) */ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video { margin: 0; padding: 0; border: 0; font-size: 100%; font: inherit; vertical-align: baseline; } /* HTML5 display-role reset for older browsers */ article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section { display: block; } body { line-height: 1; } ol, ul { list-style: none; } blockquote, q { quotes: none; } blockquote:before, blockquote:after, q:before, q:after { content: ''; content: none; } table { border-collapse: collapse; border-spacing: 0; } /* CSS Document */ body { background: #333; width: 960px; margin: 0px; padding: 20px; font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #eee; } ul li { background: url(images/accept.png) no-repeat left; list-style: none; padding: 3px 3px 3px 20px; margin-left:10px; } ul, ol { margin-bottom:10px; } ol li { list-style: none; padding: 10px 10px 5px; } ol li div.question { font-weight:bold; color:#ccc; margin-bottom:2px; } a { text-decoration: none; color: #0066FF; } h1 { font-size: 26px; font-weight: normal; margin: 0px; color: #0099FF; } h2 { font-size:15px; font-weight:bold; margin:15px 0 5px; } .code { background: #555; padding: 10px; margin-bottom: 10px; display: none; color: #eee; } .title { background: #0099FF; color: #fff; padding: 10px; } .bborder { background: #eee; border: 0px solid #ccc; padding: 3px; } .update { border: 1px solid #777; overflow: hidden; margin-top:20px; } .update h3 { margin:5px 0 5px 10px; font-weight:bold; font-size:1.1em; } .update.fh { height: auto; } .update p { margin: 10px; } .update h2 { cursor: pointer; display: block; padding: 5px; color: #fff; position: relative; text-transform: uppercase; font-size: 12px; letter-spacing: 2px; border-left: 0px solid #06f; border-bottom: 2px solid #0066FF; font-weight:bold; margin:0 0 3px; } .flexigrid div.fbutton .add { background: url(images/add.png) no-repeat center left; } .flexigrid div.fbutton .delete { background: url(images/close.png) no-repeat center left; } .flexigrid div.fbutton .edit { background: url(images/edit.png) no-repeat center left; } ================================================ FILE: js/flexigrid.js ================================================ /* * Flexigrid for jQuery - v1.1 * * Copyright (c) 2008 Paulo P. Marinas (code.google.com/p/flexigrid/) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * */ (function ($) { /* * jQuery 1.9 support. browser object has been removed in 1.9 */ var browser = $.browser if (!browser) { function uaMatch( ua ) { ua = ua.toLowerCase(); var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) || /(webkit)[ \/]([\w.]+)/.exec( ua ) || /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) || /(msie) ([\w.]+)/.exec( ua ) || ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) || []; return { browser: match[ 1 ] || "", version: match[ 2 ] || "0" }; }; var matched = uaMatch( navigator.userAgent ); browser = {}; if ( matched.browser ) { browser[ matched.browser ] = true; browser.version = matched.version; } // Chrome is Webkit, but Webkit is also Safari. if ( browser.chrome ) { browser.webkit = true; } else if ( browser.webkit ) { browser.safari = true; } } /*! * START code from jQuery UI * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * * http://docs.jquery.com/UI */ if(typeof $.support.selectstart != 'function') { $.support.selectstart = "onselectstart" in document.createElement("div"); } if(typeof $.fn.disableSelection != 'function') { $.fn.disableSelection = function() { return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) + ".ui-disableSelection", function( event ) { event.preventDefault(); }); }; } /* END code from jQuery UI */ $.addFlex = function (t, p) { if (t.grid) return false; //return if already exist p = $.extend({ //apply default properties height: 200, //default height width: 'auto', //auto width striped: true, //apply odd even stripes novstripe: false, minwidth: 30, //min width of columns minheight: 80, //min height of columns resizable: true, //allow table resizing url: false, //URL if using data from AJAX method: 'POST', //data sending method dataType: 'xml', //type of data for AJAX, either xml or json errormsg: 'Connection Error', usepager: false, nowrap: true, page: 1, //current page total: 1, //total pages useRp: true, //use the results per page select box rp: 15, //results per page rpOptions: [10, 15, 20, 30, 50], //allowed per-page values title: false, idProperty: 'id', pagestat: 'Displaying {from} to {to} of {total} items', pagetext: 'Page', outof: 'of', findtext: 'Find', params: [], //allow optional parameters to be passed around procmsg: 'Processing, please wait ...', query: '', qtype: '', nomsg: 'No items', minColToggle: 1, //minimum allowed column to be hidden showToggleBtn: true, //show or hide column toggle popup hideOnSubmit: true, autoload: true, blockOpacity: 0.5, preProcess: false, addTitleToCell: false, // add a title attr to cells with truncated contents dblClickResize: false, //auto resize column by double clicking onDragCol: false, onToggleCol: false, onChangeSort: false, onDoubleClick: false, onSuccess: false, onError: false, onSubmit: false, //using a custom populate function __mw: { //extendable middleware function holding object datacol: function(p, col, val) { //middleware for formatting data columns var _col = (typeof p.datacol[col] == 'function') ? p.datacol[col](val) : val; //format column using function if(typeof p.datacol['*'] == 'function') { //if wildcard function exists return p.datacol['*'](_col); //run wildcard function } else { return _col; //return column without wildcard } } }, getGridClass: function(g) { //get the grid class, always returns g return g; }, datacol: {}, //datacol middleware object 'colkey': function(colval) {} colResize: true, //from: http://stackoverflow.com/a/10615589 colMove: true }, p); $(t).show() //show if hidden .attr({ cellPadding: 0, cellSpacing: 0, border: 0 }) //remove padding and spacing .removeAttr('width'); //remove width properties //create grid class var g = { hset: {}, rePosDrag: function () { var cdleft = 0 - this.hDiv.scrollLeft; if (this.hDiv.scrollLeft > 0) cdleft -= Math.floor(p.cgwidth / 2); $(g.cDrag).css({ top: g.hDiv.offsetTop + 1 }); var cdpad = this.cdpad; var cdcounter=0; $('div', g.cDrag).hide(); $('thead tr:first th:visible', this.hDiv).each(function () { var n = $('thead tr:first th:visible', g.hDiv).index(this); var cdpos = parseInt($('div', this).width()); if (cdleft == 0) cdleft -= Math.floor(p.cgwidth / 2); cdpos = cdpos + cdleft + cdpad; if (isNaN(cdpos)) { cdpos = 0; } $('div:eq(' + n + ')', g.cDrag).css({ 'left': (!(browser.mozilla) ? cdpos - cdcounter : cdpos) + 'px' }).show(); cdleft = cdpos; cdcounter++; }); }, fixHeight: function (newH) { newH = false; if (!newH) newH = $(g.bDiv).height(); var hdHeight = $(this.hDiv).height(); $('div', this.cDrag).each( function () { $(this).height(newH + hdHeight); } ); var nd = parseInt($(g.nDiv).height(), 10); if (nd > newH) $(g.nDiv).height(newH).width(200); else $(g.nDiv).height('auto').width('auto'); $(g.block).css({ height: newH, marginBottom: (newH * -1) }); var hrH = g.bDiv.offsetTop + newH; if (p.height != 'auto' && p.resizable) hrH = g.vDiv.offsetTop; $(g.rDiv).css({ height: hrH }); }, dragStart: function (dragtype, e, obj) { //default drag function start if (dragtype == 'colresize' && p.colResize === true) {//column resize $(g.nDiv).hide(); $(g.nBtn).hide(); var n = $('div', this.cDrag).index(obj); var ow = $('th:visible div:eq(' + n + ')', this.hDiv).width(); $(obj).addClass('dragging').siblings().hide(); $(obj).prev().addClass('dragging').show(); this.colresize = { startX: e.pageX, ol: parseInt(obj.style.left, 10), ow: ow, n: n }; $('body').css('cursor', 'col-resize'); } else if (dragtype == 'vresize') {//table resize var hgo = false; $('body').css('cursor', 'row-resize'); if (obj) { hgo = true; $('body').css('cursor', 'col-resize'); } this.vresize = { h: p.height, sy: e.pageY, w: p.width, sx: e.pageX, hgo: hgo }; } else if (dragtype == 'colMove') {//column header drag $(e.target).disableSelection(); //disable selecting the column header if((p.colMove === true)) { $(g.nDiv).hide(); $(g.nBtn).hide(); this.hset = $(this.hDiv).offset(); this.hset.right = this.hset.left + $('table', this.hDiv).width(); this.hset.bottom = this.hset.top + $('table', this.hDiv).height(); this.dcol = obj; this.dcoln = $('th', this.hDiv).index(obj); this.colCopy = document.createElement("div"); this.colCopy.className = "colCopy"; this.colCopy.innerHTML = obj.innerHTML; if (browser.msie) { this.colCopy.className = "colCopy ie"; } $(this.colCopy).css({ position: 'absolute', 'float': 'left', display: 'none', textAlign: obj.align }); $('body').append(this.colCopy); $(this.cDrag).hide(); } } $('body').noSelect(); }, dragMove: function (e) { if (this.colresize) {//column resize var n = this.colresize.n; var diff = e.pageX - this.colresize.startX; var nleft = this.colresize.ol + diff; var nw = this.colresize.ow + diff; if (nw > p.minwidth) { $('div:eq(' + n + ')', this.cDrag).css('left', nleft); this.colresize.nw = nw; } } else if (this.vresize) {//table resize var v = this.vresize; var y = e.pageY; var diff = y - v.sy; if (!p.defwidth) p.defwidth = p.width; if (p.width != 'auto' && !p.nohresize && v.hgo) { var x = e.pageX; var xdiff = x - v.sx; var newW = v.w + xdiff; if (newW > p.defwidth) { this.gDiv.style.width = newW + 'px'; p.width = newW; } } var newH = v.h + diff; if ((newH > p.minheight || p.height < p.minheight) && !v.hgo) { this.bDiv.style.height = newH + 'px'; p.height = newH; this.fixHeight(newH); } v = null; } else if (this.colCopy) { $(this.dcol).addClass('thMove').removeClass('thOver'); if (e.pageX > this.hset.right || e.pageX < this.hset.left || e.pageY > this.hset.bottom || e.pageY < this.hset.top) { //this.dragEnd(); $('body').css('cursor', 'move'); } else { $('body').css('cursor', 'pointer'); } $(this.colCopy).css({ top: e.pageY + 10, left: e.pageX + 20, display: 'block' }); } }, dragEnd: function () { if (this.colresize) { var n = this.colresize.n; var nw = this.colresize.nw; $('th:visible div:eq(' + n + ')', this.hDiv).css('width', nw); $('tr', this.bDiv).each( function () { var $tdDiv = $('td:visible div:eq(' + n + ')', this); $tdDiv.css('width', nw); g.addTitleToCell($tdDiv); } ); this.hDiv.scrollLeft = this.bDiv.scrollLeft; $('div:eq(' + n + ')', this.cDrag).siblings().show(); $('.dragging', this.cDrag).removeClass('dragging'); this.rePosDrag(); this.fixHeight(); this.colresize = false; if ($.cookies) { var name = p.colModel[n].name; // Store the widths in the cookies $.cookie('flexiwidths/'+name, nw); } } else if (this.vresize) { this.vresize = false; } else if (this.colCopy) { $(this.colCopy).remove(); if (this.dcolt !== null) { if (this.dcoln > this.dcolt) $('th:eq(' + this.dcolt + ')', this.hDiv).before(this.dcol); else $('th:eq(' + this.dcolt + ')', this.hDiv).after(this.dcol); this.switchCol(this.dcoln, this.dcolt); $(this.cdropleft).remove(); $(this.cdropright).remove(); this.rePosDrag(); if (p.onDragCol) { p.onDragCol(this.dcoln, this.dcolt); } } this.dcol = null; this.hset = null; this.dcoln = null; this.dcolt = null; this.colCopy = null; $('.thMove', this.hDiv).removeClass('thMove'); $(this.cDrag).show(); } $('body').css('cursor', 'default'); $('body').noSelect(false); }, toggleCol: function (cid, visible) { var ncol = $("th[axis='col" + cid + "']", this.hDiv)[0]; var n = $('thead th', g.hDiv).index(ncol); var cb = $('input[value=' + cid + ']', g.nDiv)[0]; if (visible == null) { visible = ncol.hidden; } if ($('input:checked', g.nDiv).length < p.minColToggle && !visible) { return false; } if (visible) { ncol.hidden = false; $(ncol).show(); cb.checked = true; } else { ncol.hidden = true; $(ncol).hide(); cb.checked = false; } $('tbody tr', t).each( function () { if (visible) { $('td:eq(' + n + ')', this).show(); } else { $('td:eq(' + n + ')', this).hide(); } } ); this.rePosDrag(); if (p.onToggleCol) { p.onToggleCol(cid, visible); } return visible; }, switchCol: function (cdrag, cdrop) { //switch columns $('tbody tr', t).each( function () { if (cdrag > cdrop) $('td:eq(' + cdrop + ')', this).before($('td:eq(' + cdrag + ')', this)); else $('td:eq(' + cdrop + ')', this).after($('td:eq(' + cdrag + ')', this)); } ); //switch order in nDiv if (cdrag > cdrop) { $('tr:eq(' + cdrop + ')', this.nDiv).before($('tr:eq(' + cdrag + ')', this.nDiv)); } else { $('tr:eq(' + cdrop + ')', this.nDiv).after($('tr:eq(' + cdrag + ')', this.nDiv)); } if (browser.msie && browser.version < 7.0) { $('tr:eq(' + cdrop + ') input', this.nDiv)[0].checked = true; } this.hDiv.scrollLeft = this.bDiv.scrollLeft; }, scroll: function () { this.hDiv.scrollLeft = this.bDiv.scrollLeft; this.rePosDrag(); }, addData: function (data) { //parse data if (p.dataType == 'json') { data = $.extend({rows: [], page: 0, total: 0}, data); } if (p.preProcess) { data = p.preProcess(data); } $('.pReload', this.pDiv).removeClass('loading'); this.loading = false; if (!data) { $('.pPageStat', this.pDiv).html(p.errormsg); if (p.onSuccess) p.onSuccess(this); return false; } if (p.dataType == 'xml') { p.total = +$('rows total', data).text(); } else { p.total = data.total; } if (p.total === 0) { $('tr, a, td, div', t).unbind(); $(t).empty(); p.pages = 1; p.page = 1; this.buildpager(); $('.pPageStat', this.pDiv).html(p.nomsg); if (p.onSuccess) p.onSuccess(this); return false; } p.pages = Math.ceil(p.total / p.rp); if (p.dataType == 'xml') { p.page = +$('rows page', data).text(); } else { p.page = data.page; } this.buildpager(); //build new body var tbody = document.createElement('tbody'); if (p.dataType == 'json') { $.each(data.rows, function (i, row) { var tr = document.createElement('tr'); var jtr = $(tr); if (row.name) tr.name = row.name; if (row.color) { jtr.css('background',row.color); } else { if (i % 2 && p.striped) tr.className = 'erow'; } if (row[p.idProperty]) { tr.id = 'row' + row[p.idProperty]; jtr.attr('data-id', row[p.idProperty]); } $('thead tr:first th', g.hDiv).each( //add cell function () { var td = document.createElement('td'); var idx = $(this).attr('axis').substr(3); td.align = this.align; // If each row is the object itself (no 'cell' key) if (typeof row.cell == 'undefined') { td.innerHTML = row[p.colModel[idx].name]; } else { // If the json elements aren't named (which is typical), use numeric order var iHTML = ''; if (typeof row.cell[idx] != "undefined") { iHTML = (row.cell[idx] !== null) ? row.cell[idx] : ''; //null-check for Opera-browser } else { iHTML = row.cell[p.colModel[idx].name]; } td.innerHTML = p.__mw.datacol(p, $(this).attr('abbr'), iHTML); //use middleware datacol to format cols } // If the content has a option, decode it. var offs = td.innerHTML.indexOf( '0 ) { $(td).css('background', text.substr(offs+7,7) ); } $(td).attr('abbr', $(this).attr('abbr')); $(tr).append(td); td = null; } ); if ($('thead', this.gDiv).length < 1) {//handle if grid has no headers for (idx = 0; idx < row.cell.length; idx++) { var td = document.createElement('td'); // If the json elements aren't named (which is typical), use numeric order if (typeof row.cell[idx] != "undefined") { td.innerHTML = (row.cell[idx] != null) ? row.cell[idx] : '';//null-check for Opera-browser } else { td.innerHTML = row.cell[p.colModel[idx].name]; } $(tr).append(td); td = null; } } $(tbody).append(tr); tr = null; }); } else if (p.dataType == 'xml') { var i = 1; $("rows row", data).each(function () { i++; var tr = document.createElement('tr'); if ($(this).attr('name')) tr.name = $(this).attr('name'); if ($(this).attr('color')) { $(tr).css('background',$(this).attr('id')); } else { if (i % 2 && p.striped) tr.className = 'erow'; } var nid = $(this).attr('id'); if (nid) { tr.id = 'row' + nid; } nid = null; var robj = this; $('thead tr:first th', g.hDiv).each(function () { var td = document.createElement('td'); var idx = $(this).attr('axis').substr(3); td.align = this.align; var text = $("cell:eq(" + idx + ")", robj).text(); var offs = text.indexOf( '0 ) { $(td).css('background', text.substr(offs+7,7) ); } td.innerHTML = p.__mw.datacol(p, $(this).attr('abbr'), text); //use middleware datacol to format cols $(td).attr('abbr', $(this).attr('abbr')); $(tr).append(td); td = null; }); if ($('thead', this.gDiv).length < 1) {//handle if grid has no headers $('cell', this).each(function () { var td = document.createElement('td'); td.innerHTML = $(this).text(); $(tr).append(td); td = null; }); } $(tbody).append(tr); tr = null; robj = null; }); } $('tr', t).unbind(); $(t).empty(); $(t).append(tbody); this.addCellProp(); this.addRowProp(); this.rePosDrag(); tbody = null; data = null; i = null; if (p.onSuccess) { p.onSuccess(this); } if (p.hideOnSubmit) { $(g.block).remove(); } this.hDiv.scrollLeft = this.bDiv.scrollLeft; if (browser.opera) { $(t).css('visibility', 'visible'); } }, changeSort: function (th) { //change sortorder if (this.loading) { return true; } $(g.nDiv).hide(); $(g.nBtn).hide(); if (p.sortname == $(th).attr('abbr')) { if (p.sortorder == 'asc') { p.sortorder = 'desc'; } else { p.sortorder = 'asc'; } } $(th).addClass('sorted').siblings().removeClass('sorted'); $('.sdesc', this.hDiv).removeClass('sdesc'); $('.sasc', this.hDiv).removeClass('sasc'); $('div', th).addClass('s' + p.sortorder); p.sortname = $(th).attr('abbr'); if (p.onChangeSort) { p.onChangeSort(p.sortname, p.sortorder); } else { this.populate(); } }, buildpager: function () { //rebuild pager based on new properties $('.pcontrol input', this.pDiv).val(p.page); $('.pcontrol span', this.pDiv).html(p.pages); var r1 = p.total == 0 ? 0 : (p.page - 1) * p.rp + 1; var r2 = r1 + p.rp - 1; if (p.total < r2) { r2 = p.total; } var stat = p.pagestat; stat = stat.replace(/{from}/, r1); stat = stat.replace(/{to}/, r2); stat = stat.replace(/{total}/, p.total); $('.pPageStat', this.pDiv).html(stat); }, populate: function () { //get latest data if (this.loading) { return true; } if (p.onSubmit) { var gh = p.onSubmit(); if (!gh) { return false; } } this.loading = true; if (!p.url) { return false; } $('.pPageStat', this.pDiv).html(p.procmsg); $('.pReload', this.pDiv).addClass('loading'); $(g.block).css({ top: g.bDiv.offsetTop }); if (p.hideOnSubmit) { $(this.gDiv).prepend(g.block); } if (browser.opera) { $(t).css('visibility', 'hidden'); } if (!p.newp) { p.newp = 1; } if (p.page > p.pages) { p.page = p.pages; } var param = [{ name: 'page', value: p.newp }, { name: 'rp', value: p.rp }, { name: 'sortname', value: p.sortname }, { name: 'sortorder', value: p.sortorder }, { name: 'query', value: p.query }, { name: 'qtype', value: p.qtype }]; if (p.params.length) { for (var pi = 0; pi < p.params.length; pi++) { param[param.length] = p.params[pi]; } } $.ajax({ type: p.method, url: p.url, data: param, dataType: p.dataType, success: function (data) { g.addData(data); }, error: function (XMLHttpRequest, textStatus, errorThrown) { try { if (p.onError) p.onError(XMLHttpRequest, textStatus, errorThrown); } catch (e) {} } }); }, doSearch: function () { p.query = $('input[name=q]', g.sDiv).val(); p.qtype = $('select[name=qtype]', g.sDiv).val(); p.newp = 1; this.populate(); }, changePage: function (ctype) { //change page if (this.loading) { return true; } switch (ctype) { case 'first': p.newp = 1; break; case 'prev': if (p.page > 1) { p.newp = parseInt(p.page, 10) - 1; } break; case 'next': if (p.page < p.pages) { p.newp = parseInt(p.page, 10) + 1; } break; case 'last': p.newp = p.pages; break; case 'input': var nv = parseInt($('.pcontrol input', this.pDiv).val(), 10); if (isNaN(nv)) { nv = 1; } if (nv < 1) { nv = 1; } else if (nv > p.pages) { nv = p.pages; } $('.pcontrol input', this.pDiv).val(nv); p.newp = nv; break; } if (p.newp == p.page) { return false; } if (p.onChangePage) { p.onChangePage(p.newp); } else { this.populate(); } }, addCellProp: function () { $('tbody tr td', g.bDiv).each(function () { var tdDiv = document.createElement('div'); var n = $('td', $(this).parent()).index(this); var pth = $('th:eq(' + n + ')', g.hDiv).get(0); if (pth != null) { if (p.sortname == $(pth).attr('abbr') && p.sortname) { this.className = 'sorted'; } $(tdDiv).css({ textAlign: pth.align, width: $('div:first', pth)[0].style.width }); if (pth.hidden) { $(this).css('display', 'none'); } } if (p.nowrap == false) { $(tdDiv).css('white-space', 'normal'); } if (this.innerHTML == '') { this.innerHTML = ' '; } tdDiv.innerHTML = this.innerHTML; var prnt = $(this).parent()[0]; var pid = false; if (prnt.id) { pid = prnt.id.substr(3); } if (pth != null) { if (pth.process) pth.process(tdDiv, pid); } $(this).empty().append(tdDiv).removeAttr('width'); //wrap content g.addTitleToCell(tdDiv); }); }, getCellDim: function (obj) {// get cell prop for editable event var ht = parseInt($(obj).height(), 10); var pht = parseInt($(obj).parent().height(), 10); var wt = parseInt(obj.style.width, 10); var pwt = parseInt($(obj).parent().width(), 10); var top = obj.offsetParent.offsetTop; var left = obj.offsetParent.offsetLeft; var pdl = parseInt($(obj).css('paddingLeft'), 10); var pdt = parseInt($(obj).css('paddingTop'), 10); return { ht: ht, wt: wt, top: top, left: left, pdl: pdl, pdt: pdt, pht: pht, pwt: pwt }; }, addRowProp: function () { $('tbody tr', g.bDiv).on('click', function (e) { var obj = (e.target || e.srcElement); if (obj.href || obj.type) return true; if (e.ctrlKey || e.metaKey) { // mousedown already took care of this case return; } $(this).toggleClass('trSelected'); if (p.singleSelect && ! g.multisel) { $(this).siblings().removeClass('trSelected'); } }).on('mousedown', function (e) { if (e.shiftKey) { $(this).toggleClass('trSelected'); g.multisel = true; this.focus(); $(g.gDiv).noSelect(); } if (e.ctrlKey || e.metaKey) { $(this).toggleClass('trSelected'); g.multisel = true; this.focus(); } }).on('mouseup', function (e) { if (g.multisel && ! (e.ctrlKey || e.metaKey)) { g.multisel = false; $(g.gDiv).noSelect(false); } }).on('dblclick', function () { if (p.onDoubleClick) { p.onDoubleClick(this, g, p); } }).hover(function (e) { if (g.multisel && e.shiftKey) { $(this).toggleClass('trSelected'); } }, function () {}); if (browser.msie && browser.version < 7.0) { $(this).hover(function () { $(this).addClass('trOver'); }, function () { $(this).removeClass('trOver'); }); } }, combo_flag: true, combo_resetIndex: function(selObj) { if(this.combo_flag) { selObj.selectedIndex = 0; } this.combo_flag = true; }, combo_doSelectAction: function(selObj) { eval( selObj.options[selObj.selectedIndex].value ); selObj.selectedIndex = 0; this.combo_flag = false; }, //Add title attribute to div if cell contents is truncated addTitleToCell: function(tdDiv) { if(p.addTitleToCell) { var $span = $('').css('display', 'none'), $div = (tdDiv instanceof jQuery) ? tdDiv : $(tdDiv), div_w = $div.outerWidth(), span_w = 0; $('body').children(':first').before($span); $span.html($div.html()); $span.css('font-size', '' + $div.css('font-size')); $span.css('padding-left', '' + $div.css('padding-left')); span_w = $span.innerWidth(); $span.remove(); if(span_w > div_w) { $div.attr('title', $div.text()); } else { $div.removeAttr('title'); } } }, autoResizeColumn: function (obj) { if(!p.dblClickResize) { return; } var n = $('div', this.cDrag).index(obj), $th = $('th:visible div:eq(' + n + ')', this.hDiv), ol = parseInt(obj.style.left, 10), ow = $th.width(), nw = 0, nl = 0, $span = $(''); $('body').children(':first').before($span); $span.html($th.html()); $span.css('font-size', '' + $th.css('font-size')); $span.css('padding-left', '' + $th.css('padding-left')); $span.css('padding-right', '' + $th.css('padding-right')); nw = $span.width(); $('tr', this.bDiv).each(function () { var $tdDiv = $('td:visible div:eq(' + n + ')', this), spanW = 0; $span.html($tdDiv.html()); $span.css('font-size', '' + $tdDiv.css('font-size')); $span.css('padding-left', '' + $tdDiv.css('padding-left')); $span.css('padding-right', '' + $tdDiv.css('padding-right')); spanW = $span.width(); nw = (spanW > nw) ? spanW : nw; }); $span.remove(); nw = (p.minWidth > nw) ? p.minWidth : nw; nl = ol + (nw - ow); $('div:eq(' + n + ')', this.cDrag).css('left', nl); this.colresize = { nw: nw, n: n }; g.dragEnd(); }, pager: 0 }; g = p.getGridClass(g); //get the grid class if (p.colModel) { //create model if any thead = document.createElement('thead'); var tr = document.createElement('tr'); for (var i = 0; i < p.colModel.length; i++) { var cm = p.colModel[i]; var th = document.createElement('th'); $(th).attr('axis', 'col' + i); if( cm ) { // only use cm if its defined if ($.cookies) { var cookie_width = 'flexiwidths/'+cm.name; // Re-Store the widths in the cookies if( $.cookie(cookie_width) != undefined ) { cm.width = $.cookie(cookie_width); } } if( cm.display != undefined ) { th.innerHTML = cm.display; } if (cm.name && cm.sortable) { $(th).attr('abbr', cm.name); } if (cm.align) { th.align = cm.align; } if (cm.width) { $(th).attr('width', cm.width); } if ($(cm).attr('hide')) { th.hidden = true; } if (cm.process) { th.process = cm.process; } } else { th.innerHTML = ""; $(th).attr('width',30); } $(tr).append(th); } $(thead).append(tr); $(t).prepend(thead); } // end if p.colmodel //init divs g.gDiv = document.createElement('div'); //create global container g.mDiv = document.createElement('div'); //create title container g.hDiv = document.createElement('div'); //create header container g.bDiv = document.createElement('div'); //create body container g.vDiv = document.createElement('div'); //create grip g.rDiv = document.createElement('div'); //create horizontal resizer g.cDrag = document.createElement('div'); //create column drag g.block = document.createElement('div'); //creat blocker g.nDiv = document.createElement('div'); //create column show/hide popup g.nBtn = document.createElement('div'); //create column show/hide button g.iDiv = document.createElement('div'); //create editable layer g.tDiv = document.createElement('div'); //create toolbar g.sDiv = document.createElement('div'); g.pDiv = document.createElement('div'); //create pager container if(p.colResize === false) { //don't display column drag if we are not using it $(g.cDrag).css('display', 'none'); } if (!p.usepager) { g.pDiv.style.display = 'none'; } g.hTable = document.createElement('table'); g.gDiv.className = 'flexigrid'; if (p.width != 'auto') { g.gDiv.style.width = p.width + (isNaN(p.width) ? '' : 'px'); } //add conditional classes if (browser.msie) { $(g.gDiv).addClass('ie'); } if (p.novstripe) { $(g.gDiv).addClass('novstripe'); } $(t).before(g.gDiv); $(g.gDiv).append(t); //set toolbar if (p.buttons) { g.tDiv.className = 'tDiv'; var tDiv2 = document.createElement('div'); tDiv2.className = 'tDiv2'; for (var i = 0; i < p.buttons.length; i++) { var btn = p.buttons[i]; if (!btn.separator) { var btnDiv = document.createElement('div'); btnDiv.className = 'fbutton'; btnDiv.innerHTML = ("
") + (btn.hidename ? " " : btn.name) + ("
"); if (btn.bclass) $('span', btnDiv).addClass(btn.bclass).css({ paddingLeft: 20 }); if (btn.bimage) // if bimage defined, use its string as an image url for this buttons style (RS) $('span',btnDiv).css( 'background', 'url('+btn.bimage+') no-repeat center left' ); $('span',btnDiv).css( 'paddingLeft', 20 ); if (btn.tooltip) // add title if exists (RS) $('span',btnDiv)[0].title = btn.tooltip; btnDiv.onpress = btn.onpress; btnDiv.name = btn.name; if (btn.id) { btnDiv.id = btn.id; } if (btn.onpress) { $(btnDiv).click(function () { this.onpress(this.id || this.name, g.gDiv); }); } $(tDiv2).append(btnDiv); if (browser.msie && browser.version < 7.0) { $(btnDiv).hover(function () { $(this).addClass('fbOver'); }, function () { $(this).removeClass('fbOver'); }); } } else { $(tDiv2).append("
"); } } $(g.tDiv).append(tDiv2); $(g.tDiv).append("
"); $(g.gDiv).prepend(g.tDiv); } g.hDiv.className = 'hDiv'; // Define a combo button set with custom action'ed calls when clicked. if( p.combobuttons && $(g.tDiv2) ) { var btnDiv = document.createElement('div'); btnDiv.className = 'fbutton'; var tSelect = document.createElement('select'); $(tSelect).change( function () { g.combo_doSelectAction( tSelect ) } ); $(tSelect).click( function () { g.combo_resetIndex( tSelect) } ); tSelect.className = 'cselect'; $(btnDiv).append(tSelect); for (i=0;i'); $('div', g.hDiv).append(g.hTable); var thead = $("thead:first", t).get(0); if (thead) $(g.hTable).append(thead); thead = null; if (!p.colmodel) var ci = 0; $('thead tr:first th', g.hDiv).each(function () { var thdiv = document.createElement('div'); if ($(this).attr('abbr')) { $(this).click(function (e) { if (!$(this).hasClass('thOver')) return false; var obj = (e.target || e.srcElement); if (obj.href || obj.type) return true; g.changeSort(this); }); if ($(this).attr('abbr') == p.sortname) { this.className = 'sorted'; thdiv.className = 's' + p.sortorder; } } if (this.hidden) { $(this).hide(); } if (!p.colmodel) { $(this).attr('axis', 'col' + ci++); } // if there isn't a default width, then the column headers don't match // i'm sure there is a better way, but this at least stops it failing if (this.width == '') { this.width = 100; } $(thdiv).css({ textAlign: this.align, width: this.width + 'px' }); thdiv.innerHTML = this.innerHTML; $(this).empty().append(thdiv).removeAttr('width').mousedown(function (e) { g.dragStart('colMove', e, this); }).hover(function () { if (!g.colresize && !$(this).hasClass('thMove') && !g.colCopy) { $(this).addClass('thOver'); } if ($(this).attr('abbr') != p.sortname && !g.colCopy && !g.colresize && $(this).attr('abbr')) { $('div', this).addClass('s' + p.sortorder); } else if ($(this).attr('abbr') == p.sortname && !g.colCopy && !g.colresize && $(this).attr('abbr')) { var no = (p.sortorder == 'asc') ? 'desc' : 'asc'; $('div', this).removeClass('s' + p.sortorder).addClass('s' + no); } if (g.colCopy) { var n = $('th', g.hDiv).index(this); if (n == g.dcoln) { return false; } if (n < g.dcoln) { $(this).append(g.cdropleft); } else { $(this).append(g.cdropright); } g.dcolt = n; } else if (!g.colresize) { var nv = $('th:visible', g.hDiv).index(this); var onl = parseInt($('div:eq(' + nv + ')', g.cDrag).css('left'), 10); var nw = jQuery(g.nBtn).outerWidth(); var nl = onl - nw + Math.floor(p.cgwidth / 2); $(g.nDiv).hide(); $(g.nBtn).hide(); $(g.nBtn).css({ 'left': nl, top: g.hDiv.offsetTop }).show(); var ndw = parseInt($(g.nDiv).width(), 10); $(g.nDiv).css({ top: g.bDiv.offsetTop }); if ((nl + ndw) > $(g.gDiv).width()) { $(g.nDiv).css('left', onl - ndw + 1); } else { $(g.nDiv).css('left', nl); } if ($(this).hasClass('sorted')) { $(g.nBtn).addClass('srtd'); } else { $(g.nBtn).removeClass('srtd'); } } }, function () { $(this).removeClass('thOver'); if ($(this).attr('abbr') != p.sortname) { $('div', this).removeClass('s' + p.sortorder); } else if ($(this).attr('abbr') == p.sortname) { var no = (p.sortorder == 'asc') ? 'desc' : 'asc'; $('div', this).addClass('s' + p.sortorder).removeClass('s' + no); } if (g.colCopy) { $(g.cdropleft).remove(); $(g.cdropright).remove(); g.dcolt = null; } }); //wrap content }); //set bDiv g.bDiv.className = 'bDiv'; $(t).before(g.bDiv); $(g.bDiv).css({ height: (p.height == 'auto') ? 'auto' : p.height + "px" }).scroll(function (e) { g.scroll() }).append(t); if (p.height == 'auto') { $('table', g.bDiv).addClass('autoht'); } //add td & row properties g.addCellProp(); g.addRowProp(); //set cDrag only if we are using it if (p.colResize === true) { var cdcol = $('thead tr:first th:first', g.hDiv).get(0); if(cdcol !== null) { g.cDrag.className = 'cDrag'; g.cdpad = 0; g.cdpad += (isNaN(parseInt($('div', cdcol).css('borderLeftWidth'), 10)) ? 0 : parseInt($('div', cdcol).css('borderLeftWidth'), 10)); g.cdpad += (isNaN(parseInt($('div', cdcol).css('borderRightWidth'), 10)) ? 0 : parseInt($('div', cdcol).css('borderRightWidth'), 10)); g.cdpad += (isNaN(parseInt($('div', cdcol).css('paddingLeft'), 10)) ? 0 : parseInt($('div', cdcol).css('paddingLeft'), 10)); g.cdpad += (isNaN(parseInt($('div', cdcol).css('paddingRight'), 10)) ? 0 : parseInt($('div', cdcol).css('paddingRight'), 10)); g.cdpad += (isNaN(parseInt($(cdcol).css('borderLeftWidth'), 10)) ? 0 : parseInt($(cdcol).css('borderLeftWidth'), 10)); g.cdpad += (isNaN(parseInt($(cdcol).css('borderRightWidth'), 10)) ? 0 : parseInt($(cdcol).css('borderRightWidth'), 10)); g.cdpad += (isNaN(parseInt($(cdcol).css('paddingLeft'), 10)) ? 0 : parseInt($(cdcol).css('paddingLeft'), 10)); g.cdpad += (isNaN(parseInt($(cdcol).css('paddingRight'), 10)) ? 0 : parseInt($(cdcol).css('paddingRight'), 10)); $(g.bDiv).before(g.cDrag); var cdheight = $(g.bDiv).height(); var hdheight = $(g.hDiv).height(); $(g.cDrag).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); }).dblclick(function(e) { g.autoResizeColumn(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 + " "+ "
"); //Split into separate selectors because of bug in jQuery 1.3.2 $('input[name=q]', g.sDiv).keydown(function (e) { if (e.keyCode == 13) { g.doSearch(); } }); $('select[name=qtype]', g.sDiv).keydown(function (e) { if (e.keyCode == 13) { g.doSearch(); } }); $('input[value=Clear]', g.sDiv).click(function () { $('input[name=q]', g.sDiv).val(''); p.query = ''; g.doSearch(); }); $(g.bDiv).after(g.sDiv); } } $(g.pDiv, g.sDiv).append("
"); // add title if (p.title) { g.mDiv.className = 'mDiv'; g.mDiv.innerHTML = '
' + p.title + '
'; $(g.gDiv).prepend(g.mDiv); if (p.showTableToggleBtn) { $(g.mDiv).append('
'); $('div.ptogtitle', g.mDiv).click(function () { $(g.gDiv).toggleClass('hideBody'); $(this).toggleClass('vsble'); }); } } //setup cdrops g.cdropleft = document.createElement('span'); g.cdropleft.className = 'cdropleft'; g.cdropright = document.createElement('span'); g.cdropright.className = 'cdropright'; //add block g.block.className = 'gBlock'; var gh = $(g.bDiv).height(); var gtop = g.bDiv.offsetTop; $(g.block).css({ width: g.bDiv.style.width, height: gh, background: 'white', position: 'relative', marginBottom: (gh * -1), zIndex: 1, top: gtop, left: '0px' }); $(g.block).fadeTo(0, p.blockOpacity); // add column control if ($('th', g.hDiv).length) { g.nDiv.className = 'nDiv'; g.nDiv.innerHTML = "
"; $(g.nDiv).css({ marginBottom: (gh * -1), display: 'none', top: gtop }).noSelect(); var cn = 0; $('th div', g.hDiv).each(function () { var kcol = $("th[axis='col" + cn + "']", g.hDiv)[0]; var chk = 'checked="checked"'; if (kcol.style.display == 'none') { chk = ''; } $('tbody', g.nDiv).append('' + this.innerHTML + ''); cn++; }); if (browser.msie && browser.version < 7.0) $('tr', g.nDiv).hover(function () { $(this).addClass('ndcolover'); }, function () { $(this).removeClass('ndcolover'); }); $('td.ndcol2', g.nDiv).click(function () { if ($('input:checked', g.nDiv).length <= p.minColToggle && $(this).prev().find('input')[0].checked) return false; return g.toggleCol($(this).prev().find('input').val()); }); $('input.togCol', g.nDiv).click(function () { if ($('input:checked', g.nDiv).length < p.minColToggle && this.checked === false) return false; $(this).parent().next().trigger('click'); }); $(g.gDiv).prepend(g.nDiv); $(g.nBtn).addClass('nBtn') .html('
') .attr('title', 'Hide/Show Columns') .click(function () { $(g.nDiv).toggle(); return true; } ); if (p.showToggleBtn) { $(g.gDiv).prepend(g.nBtn); } } // add date edit layer $(g.iDiv).addClass('iDiv').css({ display: 'none' }); $(g.bDiv).append(g.iDiv); // add flexigrid events $(g.bDiv).hover(function () { $(g.nDiv).hide(); $(g.nBtn).hide(); }, function () { if (g.multisel) { g.multisel = false; } }); $(g.gDiv).hover(function () {}, function () { $(g.nDiv).hide(); $(g.nBtn).hide(); }); //add document events $(document).mousemove(function (e) { g.dragMove(e); }).mouseup(function (e) { g.dragEnd(); }).hover(function () {}, function () { g.dragEnd(); }); //browser adjustments if (browser.msie && browser.version < 7.0) { $('.hDiv,.bDiv,.mDiv,.pDiv,.vGrip,.tDiv, .sDiv', g.gDiv).css({ 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 $.fn.flexSearch = function(p) { // function to search grid return this.each( function() { if (this.grid&&this.p.searchitems) this.grid.doSearch(); }); }; //end flexSearch $.fn.selectedRows = function (p) { // Returns the selected rows as an array, taken and adapted from http://stackoverflow.com/questions/11868404/flexigrid-get-selected-row-columns-values var arReturn = []; var arRow = []; var selector = $(this.selector + ' .trSelected'); $(selector).each(function (i, row) { arRow = []; var idr = $(row).data('id'); $.each(row.cells, function (c, cell) { var col = cell.abbr; var val = cell.firstChild.innerHTML; if (val == ' ') val = ''; // Trim the content var idx = cell.cellIndex; arRow.push({ Column: col, // Column identifier Value: val, // Column value CellIndex: idx, // Cell index RowIdentifier: idr // Identifier of this row element }); }); arReturn.push(arRow); }); return arReturn; }; })(jQuery); ================================================ FILE: js/flexigrid.pack.js ================================================ (function($){var browser=$.browser;if(!browser){function uaMatch(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}}var matched=uaMatch(navigator.userAgent);browser={};if(matched.browser){browser[matched.browser]=true;browser.version=matched.version}if(browser.chrome){browser.webkit=true}else if(browser.webkit){browser.safari=true}}if(typeof $.support.selectstart!="function"){$.support.selectstart="onselectstart"in document.createElement("div")}if(typeof $.fn.disableSelection!="function"){$.fn.disableSelection=function(){return this.bind(($.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault()})}}$.addFlex=function(t,p){if(t.grid)return false;p=$.extend({height:200,width:"auto",striped:true,novstripe:false,minwidth:30,minheight:80,resizable:true,url:false,method:"POST",dataType:"xml",errormsg:"Connection Error",usepager:false,nowrap:true,page:1,total:1,useRp:true,rp:15,rpOptions:[10,20,30,50,100],title:false,idProperty:"id",pagestat:"Displaying {from} to {to} of {total} items",pagetext:"Page",outof:"of",findtext:"Find",params:[],procmsg:"Processing, please wait ...",query:"",qtype:"",nomsg:"No items",minColToggle:1,showToggleBtn:true,hideOnSubmit:true,autoload:true,blockOpacity:.5,preProcess:false,addTitleToCell:false,dblClickResize:false,onDragCol:false,onToggleCol:false,onChangeSort:false,onDoubleClick:false,onSuccess:false,onError:false,onSubmit:false,__mw:{datacol:function(e,t,n){var r=typeof e.datacol[t]=="function"?e.datacol[t](n):n;if(typeof e.datacol["*"]=="function"){return e.datacol["*"](r)}else{return r}}},getGridClass:function(e){return e},datacol:{},colResize:true,colMove:true},p);$(t).show().attr({cellPadding:0,cellSpacing:0,border:0}).removeAttr("width");var g={hset:{},rePosDrag:function(){var e=0-this.hDiv.scrollLeft;if(this.hDiv.scrollLeft>0)e-=Math.floor(p.cgwidth/2);$(g.cDrag).css({top:g.hDiv.offsetTop+1});var t=this.cdpad;var n=0;$("div",g.cDrag).hide();$("thead tr:first th:visible",this.hDiv).each(function(){var r=$("thead tr:first th:visible",g.hDiv).index(this);var i=parseInt($("div",this).width());if(e==0)e-=Math.floor(p.cgwidth/2);i=i+e+t;if(isNaN(i)){i=0}$("div:eq("+r+")",g.cDrag).css({left:(!browser.mozilla?i-n:i)+"px"}).show();e=i;n++})},fixHeight:function(e){e=false;if(!e)e=$(g.bDiv).height();var t=$(this.hDiv).height();$("div",this.cDrag).each(function(){$(this).height(e+t)});var n=parseInt($(g.nDiv).height(),10);if(n>e)$(g.nDiv).height(e).width(200);else $(g.nDiv).height("auto").width("auto");$(g.block).css({height:e,marginBottom:e*-1});var r=g.bDiv.offsetTop+e;if(p.height!="auto"&&p.resizable)r=g.vDiv.offsetTop;$(g.rDiv).css({height:r})},dragStart:function(e,t,n){if(e=="colresize"&&p.colResize===true){$(g.nDiv).hide();$(g.nBtn).hide();var r=$("div",this.cDrag).index(n);var i=$("th:visible div:eq("+r+")",this.hDiv).width();$(n).addClass("dragging").siblings().hide();$(n).prev().addClass("dragging").show();this.colresize={startX:t.pageX,ol:parseInt(n.style.left,10),ow:i,n:r};$("body").css("cursor","col-resize")}else if(e=="vresize"){var s=false;$("body").css("cursor","row-resize");if(n){s=true;$("body").css("cursor","col-resize")}this.vresize={h:p.height,sy:t.pageY,w:p.width,sx:t.pageX,hgo:s}}else if(e=="colMove"){$(t.target).disableSelection();if(p.colMove===true){$(g.nDiv).hide();$(g.nBtn).hide();this.hset=$(this.hDiv).offset();this.hset.right=this.hset.left+$("table",this.hDiv).width();this.hset.bottom=this.hset.top+$("table",this.hDiv).height();this.dcol=n;this.dcoln=$("th",this.hDiv).index(n);this.colCopy=document.createElement("div");this.colCopy.className="colCopy";this.colCopy.innerHTML=n.innerHTML;if(browser.msie){this.colCopy.className="colCopy ie"}$(this.colCopy).css({position:"absolute","float":"left",display:"none",textAlign:n.align});$("body").append(this.colCopy);$(this.cDrag).hide()}}$("body").noSelect()},dragMove:function(e){if(this.colresize){var t=this.colresize.n;var n=e.pageX-this.colresize.startX;var r=this.colresize.ol+n;var i=this.colresize.ow+n;if(i>p.minwidth){$("div:eq("+t+")",this.cDrag).css("left",r);this.colresize.nw=i}}else if(this.vresize){var s=this.vresize;var o=e.pageY;var n=o-s.sy;if(!p.defwidth)p.defwidth=p.width;if(p.width!="auto"&&!p.nohresize&&s.hgo){var u=e.pageX;var a=u-s.sx;var f=s.w+a;if(f>p.defwidth){this.gDiv.style.width=f+"px";p.width=f}}var l=s.h+n;if((l>p.minheight||p.heightthis.hset.right||e.pageXthis.hset.bottom||e.pageYthis.dcolt)$("th:eq("+this.dcolt+")",this.hDiv).before(this.dcol);else $("th:eq("+this.dcolt+")",this.hDiv).after(this.dcol);this.switchCol(this.dcoln,this.dcolt);$(this.cdropleft).remove();$(this.cdropright).remove();this.rePosDrag();if(p.onDragCol){p.onDragCol(this.dcoln,this.dcolt)}}this.dcol=null;this.hset=null;this.dcoln=null;this.dcolt=null;this.colCopy=null;$(".thMove",this.hDiv).removeClass("thMove");$(this.cDrag).show()}$("body").css("cursor","default");$("body").noSelect(false)},toggleCol:function(e,n){var r=$("th[axis='col"+e+"']",this.hDiv)[0];var i=$("thead th",g.hDiv).index(r);var s=$("input[value="+e+"]",g.nDiv)[0];if(n==null){n=r.hidden}if($("input:checked",g.nDiv).lengthn)$("td:eq("+n+")",this).before($("td:eq("+e+")",this));else $("td:eq("+n+")",this).after($("td:eq("+e+")",this))});if(e>n){$("tr:eq("+n+")",this.nDiv).before($("tr:eq("+e+")",this.nDiv))}else{$("tr:eq("+n+")",this.nDiv).after($("tr:eq("+e+")",this.nDiv))}if(browser.msie&&browser.version<7){$("tr:eq("+n+") input",this.nDiv)[0].checked=true}this.hDiv.scrollLeft=this.bDiv.scrollLeft},scroll:function(){this.hDiv.scrollLeft=this.bDiv.scrollLeft;this.rePosDrag()},addData:function(e){if(p.dataType=="json"){e=$.extend({rows:[],page:0,total:0},e)}if(p.preProcess){e=p.preProcess(e)}$(".pReload",this.pDiv).removeClass("loading");this.loading=false;if(!e){$(".pPageStat",this.pDiv).html(p.errormsg);if(p.onSuccess)p.onSuccess(this);return false}if(p.dataType=="xml"){p.total=+$("rows total",e).text()}else{p.total=e.total}if(p.total===0){$("tr, a, td, div",t).unbind();$(t).empty();p.pages=1;p.page=1;this.buildpager();$(".pPageStat",this.pDiv).html(p.nomsg);if(p.onSuccess)p.onSuccess(this);return false}p.pages=Math.ceil(p.total/p.rp);if(p.dataType=="xml"){p.page=+$("rows page",e).text()}else{p.page=e.page}this.buildpager();var n=document.createElement("tbody");if(p.dataType=="json"){$.each(e.rows,function(e,t){var r=document.createElement("tr");var i=$(r);if(t.name)r.name=t.name;if(t.color){i.css("background",t.color)}else{if(e%2&&p.striped)r.className="erow"}if(t[p.idProperty]){r.id="row"+t[p.idProperty];i.attr("data-id",t[p.idProperty])}$("thead tr:first th",g.hDiv).each(function(){var e=document.createElement("td");var n=$(this).attr("axis").substr(3);e.align=this.align;if(typeof t.cell=="undefined"){e.innerHTML=t[p.colModel[n].name]}else{var i="";if(typeof t.cell[n]!="undefined"){i=t.cell[n]!==null?t.cell[n]:""}else{i=t.cell[p.colModel[n].name]}e.innerHTML=p.__mw.datacol(p,$(this).attr("abbr"),i)}var s=e.innerHTML.indexOf("0){$(e).css("background",text.substr(s+7,7))}$(e).attr("abbr",$(this).attr("abbr"));$(r).append(e);e=null});if($("thead",this.gDiv).length<1){for(idx=0;idx0){$(t).css("background",r.substr(i+7,7))}t.innerHTML=p.__mw.datacol(p,$(this).attr("abbr"),r);$(t).attr("abbr",$(this).attr("abbr"));$(e).append(t);t=null});if($("thead",this.gDiv).length<1){$("cell",this).each(function(){var t=document.createElement("td");t.innerHTML=$(this).text();$(e).append(t);t=null})}$(n).append(e);e=null;s=null})}$("tr",t).unbind();$(t).empty();$(t).append(n);this.addCellProp();this.addRowProp();this.rePosDrag();n=null;e=null;r=null;if(p.onSuccess){p.onSuccess(this)}if(p.hideOnSubmit){$(g.block).remove()}this.hDiv.scrollLeft=this.bDiv.scrollLeft;if(browser.opera){$(t).css("visibility","visible")}},changeSort:function(e){if(this.loading){return true}$(g.nDiv).hide();$(g.nBtn).hide();if(p.sortname==$(e).attr("abbr")){if(p.sortorder=="asc"){p.sortorder="desc"}else{p.sortorder="asc"}}$(e).addClass("sorted").siblings().removeClass("sorted");$(".sdesc",this.hDiv).removeClass("sdesc");$(".sasc",this.hDiv).removeClass("sasc");$("div",e).addClass("s"+p.sortorder);p.sortname=$(e).attr("abbr");if(p.onChangeSort){p.onChangeSort(p.sortname,p.sortorder)}else{this.populate()}},buildpager:function(){$(".pcontrol input",this.pDiv).val(p.page);$(".pcontrol span",this.pDiv).html(p.pages);var e=(p.page-1)*p.rp+1;var t=e+p.rp-1;if(p.totalp.pages){p.page=p.pages}var n=[{name:"page",value:p.newp},{name:"rp",value:p.rp},{name:"sortname",value:p.sortname},{name:"sortorder",value:p.sortorder},{name:"query",value:p.query},{name:"qtype",value:p.qtype}];if(p.params.length){for(var r=0;r1){p.newp=parseInt(p.page,10)-1}break;case"next":if(p.pagep.pages){t=p.pages}$(".pcontrol input",this.pDiv).val(t);p.newp=t;break}if(p.newp==p.page){return false}if(p.onChangePage){p.onChangePage(p.newp)}else{this.populate()}},addCellProp:function(){$("tbody tr td",g.bDiv).each(function(){var e=document.createElement("div");var t=$("td",$(this).parent()).index(this);var n=$("th:eq("+t+")",g.hDiv).get(0);if(n!=null){if(p.sortname==$(n).attr("abbr")&&p.sortname){this.className="sorted"}$(e).css({textAlign:n.align,width:$("div:first",n)[0].style.width});if(n.hidden){$(this).css("display","none")}}if(p.nowrap==false){$(e).css("white-space","normal")}if(this.innerHTML==""){this.innerHTML=" "}e.innerHTML=this.innerHTML;var r=$(this).parent()[0];var i=false;if(r.id){i=r.id.substr(3)}if(n!=null){if(n.process)n.process(e,i)}$(this).empty().append(e).removeAttr("width");g.addTitleToCell(e)})},getCellDim:function(e){var t=parseInt($(e).height(),10);var n=parseInt($(e).parent().height(),10);var r=parseInt(e.style.width,10);var i=parseInt($(e).parent().width(),10);var s=e.offsetParent.offsetTop;var o=e.offsetParent.offsetLeft;var u=parseInt($(e).css("paddingLeft"),10);var a=parseInt($(e).css("paddingTop"),10);return{ht:t,wt:r,top:s,left:o,pdl:u,pdt:a,pht:n,pwt:i}},addRowProp:function(){$("tbody tr",g.bDiv).on("click",function(e){var t=e.target||e.srcElement;if(t.href||t.type)return true;if(e.ctrlKey||e.metaKey){return}$(this).toggleClass("trSelected");if(p.singleSelect&&!g.multisel){$(this).siblings().removeClass("trSelected")}}).on("mousedown",function(e){if(e.shiftKey){$(this).toggleClass("trSelected");g.multisel=true;this.focus();$(g.gDiv).noSelect()}if(e.ctrlKey||e.metaKey){$(this).toggleClass("trSelected");g.multisel=true;this.focus()}}).on("mouseup",function(e){if(g.multisel&&!(e.ctrlKey||e.metaKey)){g.multisel=false;$(g.gDiv).noSelect(false)}}).on("dblclick",function(){$(this).addClass("trSelected");if(p.onDoubleClick){p.onDoubleClick(this,g,p)}}).hover(function(e){if(g.multisel&&e.shiftKey){$(this).toggleClass("trSelected")}},function(){});if(browser.msie&&browser.version<7){$(this).hover(function(){$(this).addClass("trOver")},function(){$(this).removeClass("trOver")})}},combo_flag:true,combo_resetIndex:function(e){if(this.combo_flag){e.selectedIndex=0}this.combo_flag=true},combo_doSelectAction:function(selObj){eval(selObj.options[selObj.selectedIndex].value);selObj.selectedIndex=0;this.combo_flag=false},addTitleToCell:function(e){if(p.addTitleToCell){var t=$("").css("display","none"),n=e instanceof jQuery?e:$(e),r=n.outerWidth(),i=0;$("body").children(":first").before(t);t.html(n.html());t.css("font-size",""+n.css("font-size"));t.css("padding-left",""+n.css("padding-left"));i=t.innerWidth();t.remove();if(i>r){n.attr("title",n.text())}else{n.removeAttr("title")}}},autoResizeColumn:function(e){if(!p.dblClickResize){return}var t=$("div",this.cDrag).index(e),n=$("th:visible div:eq("+t+")",this.hDiv),r=parseInt(e.style.left,10),i=n.width(),s=0,o=0,u=$("");$("body").children(":first").before(u);u.html(n.html());u.css("font-size",""+n.css("font-size"));u.css("padding-left",""+n.css("padding-left"));u.css("padding-right",""+n.css("padding-right"));s=u.width();$("tr",this.bDiv).each(function(){var e=$("td:visible div:eq("+t+")",this),n=0;u.html(e.html());u.css("font-size",""+e.css("font-size"));u.css("padding-left",""+e.css("padding-left"));u.css("padding-right",""+e.css("padding-right"));n=u.width();s=n>s?n:s});u.remove();s=p.minWidth>s?p.minWidth:s;o=r+(s-i);$("div:eq("+t+")",this.cDrag).css("left",o);this.colresize={nw:s,n:t};g.dragEnd()},pager:0};g=p.getGridClass(g);if(p.colModel){thead=document.createElement("thead");var tr=document.createElement("tr");for(var i=0;i"+(btn.hidename?" ":btn.name)+"";if(btn.bclass)$("span",btnDiv).addClass(btn.bclass).css({paddingLeft:20});if(btn.bimage)$("span",btnDiv).css("background","url("+btn.bimage+") no-repeat center left");$("span",btnDiv).css("paddingLeft",20);if(btn.tooltip)$("span",btnDiv)[0].title=btn.tooltip;btnDiv.onpress=btn.onpress;btnDiv.name=btn.name;if(btn.id){btnDiv.id=btn.id}if(btn.onpress){$(btnDiv).click(function(){this.onpress(this.id||this.name,g.gDiv)})}$(tDiv2).append(btnDiv);if(browser.msie&&browser.version<7){$(btnDiv).hover(function(){$(this).addClass("fbOver")},function(){$(this).removeClass("fbOver")})}}else{$(tDiv2).append("
")}}$(g.tDiv).append(tDiv2);$(g.tDiv).append("
");$(g.gDiv).prepend(g.tDiv)}g.hDiv.className="hDiv";if(p.combobuttons&&$(g.tDiv2)){var btnDiv=document.createElement("div");btnDiv.className="fbutton";var tSelect=document.createElement("select");$(tSelect).change(function(){g.combo_doSelectAction(tSelect)});$(tSelect).click(function(){g.combo_resetIndex(tSelect)});tSelect.className="cselect";$(btnDiv).append(tSelect);for(i=0;i');$("div",g.hDiv).append(g.hTable);var thead=$("thead:first",t).get(0);if(thead)$(g.hTable).append(thead);thead=null;if(!p.colmodel)var ci=0;$("thead tr:first th",g.hDiv).each(function(){var e=document.createElement("div");if($(this).attr("abbr")){$(this).click(function(e){if(!$(this).hasClass("thOver"))return false;var t=e.target||e.srcElement;if(t.href||t.type)return true;g.changeSort(this)});if($(this).attr("abbr")==p.sortname){this.className="sorted";e.className="s"+p.sortorder}}if(this.hidden){$(this).hide()}if(!p.colmodel){$(this).attr("axis","col"+ci++)}if(this.width==""){this.width=100}$(e).css({textAlign:this.align,width:this.width+"px"});e.innerHTML=this.innerHTML;$(this).empty().append(e).removeAttr("width").mousedown(function(e){g.dragStart("colMove",e,this)}).hover(function(){if(!g.colresize&&!$(this).hasClass("thMove")&&!g.colCopy){$(this).addClass("thOver")}if($(this).attr("abbr")!=p.sortname&&!g.colCopy&&!g.colresize&&$(this).attr("abbr")){$("div",this).addClass("s"+p.sortorder)}else if($(this).attr("abbr")==p.sortname&&!g.colCopy&&!g.colresize&&$(this).attr("abbr")){var e=p.sortorder=="asc"?"desc":"asc";$("div",this).removeClass("s"+p.sortorder).addClass("s"+e)}if(g.colCopy){var t=$("th",g.hDiv).index(this);if(t==g.dcoln){return false}if(t$(g.gDiv).width()){$(g.nDiv).css("left",r-o+1)}else{$(g.nDiv).css("left",s)}if($(this).hasClass("sorted")){$(g.nBtn).addClass("srtd")}else{$(g.nBtn).removeClass("srtd")}}},function(){$(this).removeClass("thOver");if($(this).attr("abbr")!=p.sortname){$("div",this).removeClass("s"+p.sortorder)}else if($(this).attr("abbr")==p.sortname){var e=p.sortorder=="asc"?"desc":"asc";$("div",this).addClass("s"+p.sortorder).removeClass("s"+e)}if(g.colCopy){$(g.cdropleft).remove();$(g.cdropright).remove();g.dcolt=null}})});g.bDiv.className="bDiv";$(t).before(g.bDiv);$(g.bDiv).css({height:p.height=="auto"?"auto":p.height+"px"}).scroll(function(e){g.scroll()}).append(t);if(p.height=="auto"){$("table",g.bDiv).addClass("autoht")}g.addCellProp();g.addRowProp();if(p.colResize===true){var cdcol=$("thead tr:first th:first",g.hDiv).get(0);if(cdcol!==null){g.cDrag.className="cDrag";g.cdpad=0;g.cdpad+=isNaN(parseInt($("div",cdcol).css("borderLeftWidth"),10))?0:parseInt($("div",cdcol).css("borderLeftWidth"),10);g.cdpad+=isNaN(parseInt($("div",cdcol).css("borderRightWidth"),10))?0:parseInt($("div",cdcol).css("borderRightWidth"),10);g.cdpad+=isNaN(parseInt($("div",cdcol).css("paddingLeft"),10))?0:parseInt($("div",cdcol).css("paddingLeft"),10);g.cdpad+=isNaN(parseInt($("div",cdcol).css("paddingRight"),10))?0:parseInt($("div",cdcol).css("paddingRight"),10);g.cdpad+=isNaN(parseInt($(cdcol).css("borderLeftWidth"),10))?0:parseInt($(cdcol).css("borderLeftWidth"),10);g.cdpad+=isNaN(parseInt($(cdcol).css("borderRightWidth"),10))?0:parseInt($(cdcol).css("borderRightWidth"),10);g.cdpad+=isNaN(parseInt($(cdcol).css("paddingLeft"),10))?0:parseInt($(cdcol).css("paddingLeft"),10);g.cdpad+=isNaN(parseInt($(cdcol).css("paddingRight"),10))?0:parseInt($(cdcol).css("paddingRight"),10);$(g.bDiv).before(g.cDrag);var cdheight=$(g.bDiv).height();var hdheight=$(g.hDiv).height();$(g.cDrag).css({top:-hdheight+"px"});$("thead tr:first th",g.hDiv).each(function(){var e=document.createElement("div");$(g.cDrag).append(e);if(!p.cgwidth){p.cgwidth=$(e).width()}$(e).css({height:cdheight+hdheight}).mousedown(function(e){g.dragStart("colresize",e,this)}).dblclick(function(e){g.autoResizeColumn(this)});if(browser.msie&&browser.version<7){g.fixHeight($(g.gDiv).height());$(e).hover(function(){g.fixHeight();$(this).addClass("dragging")},function(){if(!g.colresize){$(this).removeClass("dragging")}})}})}}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){$(g.rDiv).hover(function(){$(this).addClass("hgOver")},function(){$(this).removeClass("hgOver")})}$(g.gDiv).append(g.rDiv)}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[nx]+"  "}$(".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()}})}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")})});g.sDiv.className="sDiv";var sitems=p.searchitems;var sopt="",sel="";for(var s=0;s"+sitems[s].display+"  "}if(p.qtype===""){p.qtype=sitems[0].name}$(g.sDiv).append("
"+p.findtext+" "+"
");$("input[name=q]",g.sDiv).keydown(function(e){if(e.keyCode==13){g.doSearch()}});$("select[name=qtype]",g.sDiv).keydown(function(e){if(e.keyCode==13){g.doSearch()}});$("input[value=Clear]",g.sDiv).click(function(){$("input[name=q]",g.sDiv).val("");p.query="";g.doSearch()});$(g.bDiv).after(g.sDiv)}}$(g.pDiv,g.sDiv).append("
");if(p.title){g.mDiv.className="mDiv";g.mDiv.innerHTML='
'+p.title+"
";$(g.gDiv).prepend(g.mDiv);if(p.showTableToggleBtn){$(g.mDiv).append('
');$("div.ptogtitle",g.mDiv).click(function(){$(g.gDiv).toggleClass("hideBody");$(this).toggleClass("vsble")})}}g.cdropleft=document.createElement("span");g.cdropleft.className="cdropleft";g.cdropright=document.createElement("span");g.cdropright.className="cdropright";g.block.className="gBlock";var gh=$(g.bDiv).height();var gtop=g.bDiv.offsetTop;$(g.block).css({width:g.bDiv.style.width,height:gh,background:"white",position:"relative",marginBottom:gh*-1,zIndex:1,top:gtop,left:"0px"});$(g.block).fadeTo(0,p.blockOpacity);if($("th",g.hDiv).length){g.nDiv.className="nDiv";g.nDiv.innerHTML="
";$(g.nDiv).css({marginBottom:gh*-1,display:"none",top:gtop}).noSelect();var cn=0;$("th div",g.hDiv).each(function(){var e=$("th[axis='col"+cn+"']",g.hDiv)[0];var t='checked="checked"';if(e.style.display=="none"){t=""}$("tbody",g.nDiv).append(''+this.innerHTML+"");cn++});if(browser.msie&&browser.version<7)$("tr",g.nDiv).hover(function(){$(this).addClass("ndcolover")},function(){$(this).removeClass("ndcolover")});$("td.ndcol2",g.nDiv).click(function(){if($("input:checked",g.nDiv).length<=p.minColToggle&&$(this).prev().find("input")[0].checked)return false;return g.toggleCol($(this).prev().find("input").val())});$("input.togCol",g.nDiv).click(function(){if($("input:checked",g.nDiv).length").attr("title","Hide/Show Columns").click(function(){$(g.nDiv).toggle();return true});if(p.showToggleBtn){$(g.gDiv).prepend(g.nBtn)}}$(g.iDiv).addClass("iDiv").css({display:"none"});$(g.bDiv).append(g.iDiv);$(g.bDiv).hover(function(){$(g.nDiv).hide();$(g.nBtn).hide()},function(){if(g.multisel){g.multisel=false}});$(g.gDiv).hover(function(){},function(){$(g.nDiv).hide();$(g.nBtn).hide()});$(document).mousemove(function(e){g.dragMove(e)}).mouseup(function(e){g.dragEnd()}).hover(function(){},function(){g.dragEnd()});if(browser.msie&&browser.version<7){$(".hDiv,.bDiv,.mDiv,.pDiv,.vGrip,.tDiv, .sDiv",g.gDiv).css({width:"100%"});$(g.gDiv).addClass("ie6");if(p.width!="auto"){$(g.gDiv).addClass("ie6fullwidthbug")}}g.rePosDrag();g.fixHeight();t.p=p;t.grid=g;if(p.url&&p.autoload){g.populate()}return t};var docloaded=false;$(document).ready(function(){docloaded=true});$.fn.flexigrid=function(e){return this.each(function(){if(!docloaded){$(this).hide();var t=this;$(document).ready(function(){$.addFlex(t,e)})}else{$.addFlex(this,e)}})};$.fn.flexReload=function(e){return this.each(function(){if(this.grid&&this.p.url)this.grid.populate()})};$.fn.flexOptions=function(e){return this.each(function(){if(this.grid)$.extend(this.p,e)})};$.fn.flexToggleCol=function(e,t){return this.each(function(){if(this.grid)this.grid.toggleCol(e,t)})};$.fn.flexAddData=function(e){return this.each(function(){if(this.grid)this.grid.addData(e)})};$.fn.noSelect=function(e){var t=e===null?true:e;if(t){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")})}};$.fn.flexSearch=function(e){return this.each(function(){if(this.grid&&this.p.searchitems)this.grid.doSearch()})};$.fn.selectedRows=function(e){var t=[];var n=[];var r=$(this.selector+" .trSelected");$(r).each(function(e,r){n=[];var i=$(r).data("id");$.each(r.cells,function(e,t){var r=t.abbr;var s=t.firstChild.innerHTML;if(s==" ")s="";var o=t.cellIndex;n.push({Column:r,Value:s,CellIndex:o,RowIdentifier:i})});t.push(n)});return t}})(jQuery)