|
|||||||
|
|||||||
IntroductionWith CodeThatGrid you can
For work with CodeThatGrid you need the following files:
<script language="javascript" src="../Scripts/codethatsdk.js"></script> // SDK
<script language="javascript" src="../Scripts/codethattype.js"></script> // Types and compare functions
<script language="javascript" src="../Scripts/codethatgridstd.js"></script> // CodeThatGrid Class
CodeThatGrid Initialization:
<script language="javascript1.2">
<!--
var CodeThatGrid = new CCodeThatGrid("CodeThatGrid", NUM_ROWS, NUM_COLS);
CodeThatGrid.init(gridDef); // data initialization from gridDef object
CodeThatGrid.doAction(); // start action
//-->
</script>
CCodeThatGrid constructor parameters: CodeThatGrid : Object - variable-link to the object from CCodeThatGrid class, its name must be equal with name passing to constructor NUM_ROWS : int - rows number at the grid NUM_COLS : int - columns number at the grid Note: if actual data size bigger than NUM_ROWS x NUM_COLS, the size of grid will be increased automaticlyBelow is a general object gridDef:
var gridDef = {
useRCID : Boolean, // whether we use row/column header, default:true
useExportBar : Boolean, // whether show layer with export form or not,
// default:false
useMultiSort : Boolean, // whether we use multisort, default:true
useColTitle : Boolean, // whether we show column titles, default:true,
useProgress : Boolean, // whether we show information about grid actions,
// default:true
amountPerPage : int, // count records per 1 page, default:20
datatype : 0|1|2|3|4, // 0 - array (default), 1 - csv String, 2 - xml file,
// 3 - csv file, 4 - xml String
data : Array | String, // data
colDef : Array, //[{...}, ...] column definitions array,
// if empty will use DEFAULT_COLDEF
tableStyle : {
...
}, // style parameters for table in whole
rowStyle : {
...
}, // row style parameters
colStyle : {
...
}, // column stle parameters
cellStyle : {
...
}, // cell style parameters
toolBar : {
...
}, // toolbar parameters
// if you'd like to hide some button just remove this button description
// from the toolbar description
statusBar : {
...
}, // statusbar parameters
pageTurnBar : {
...
}
// pageturnbar parameters
};
Note: Parameters data : [] and colDef:[] are optional. It means in case you leave its empty, you'll create an empty grid. Global variables:
var DATE_FORMAT = "dd.mm.yyyy"; // data format
var CURRENCY_FORMAT = "$"; // currency format
var EMPTY_ROW = "no filter"; // first row fo filterr
// default column definition, it uses when column has not own definition or new column created
var DEFAULT_COLDEF = {
title : "",
titleClass : "",
type : "String", //the default data type for grid
width : 80,
alignment : "left",
compareFunction : compare,
userFunction : null,
isVisible : true,
isReadOnly : false,
useAutoIndex : false,
useAutoFilter : false
};
Note: Each of this variable you can redefine. |
|||||||
© CodeThat.com, 2003-2005 |