CodeThatGrid - Grid Generation from the csv file
//GLOBAL VARS
var DATE_FORMAT = "dd.mm.yyyy", CURRENCY_FORMAT = "$", EMPTY_ROW = "",
DEFAULT_COLDEF = {
title : "",
titleClass : "",
type : "String", //the default type
width : 80,
alignment : "",
compareFunction : compare,
isVisible : 1,
isReadOnly : 0,
useAutoIndex : 0,
useAutoFilter : 0
};
//-----------------------------------------------------------------------------------
//GRID DEFINITION
//-----------------------------------------------------------------------------------
var gridDef = {
useExportBar : false,
useMultiSort : true,
useColTitle : true,
datatype : 3,
data : "csv.xml",
colDef : [
{
title : "ID",
titleClass : "",
type : "Number",
width : 0,
alignment : "center",
compareFunction : compare,
isVisible : true,
useAutoIndex : true,
useAutoFilter : false
},
{
title : "Name",
titleClass : "",
type : "String",
width : 0,
alignment : "",
compareFunction : compare,
isVisible : true,
useAutoIndex : true,
useAutoFilter : false
},
{
title : "Reg. date",
titleClass : "",
type : "Date",
width : 0,
alignment : "center",
compareFunction : compare,
isVisible : true,
useAutoIndex : true,
useAutoFilter : false
},
{
title : "Account",
titleClass : "",
type : "Currency",
width : 0,
alignment : "center",
compareFunction : compare,
isVisible : true,
useAutoIndex : true,
useAutoFilter : false
} ],
tableStyle : {
tableClass : {
borderwidth : 1, bordercolor : "#bbbbbb", borderstyle : "solid"
},
bgcolor : "#ffffff",
x : 10,
y : 10,
width : 550,
height : 480
},
rowStyle : {
defaultClass : {
fontfamily : "Verdana", fontsize : "11px", backgroundcolor : "#cecece",
borderwidth : "1", borderstyle : "outset", bordercolor : "#cecece"
},
markClass : {
fontfamily : "Verdana", fontsize : "11px", backgroundcolor : "#ffffcc",
borderwidth : "1", borderstyle : "outset", bordercolor : "#cecece"
},
dragClass : {
cursor : "move", borderwidth : "0"
},
width : 20,
height : 21
},
colStyle : {
defaultClass : {
fontfamily : "Verdana", fontsize : "12px", backgroundcolor : "#cecece",
borderwidth : "1", borderstyle : "outset", bordercolor : "#cecece"
},
markClass : {
fontfamily : "Verdana", fontsize : "12px", backgroundcolor : "#ffffcc",
borderwidth : "1", borderstyle : "outset", bordercolor : "#cecece"
},
dragClass : {
cursor : "move", borderwidth : "0"
},
width : 100,
height : 21
},
cellStyle : {
defaultClass : {
borderwidth : "1", borderstyle : "solid", bordercolor : "#cfcfcf",
fontfamily : "Arial", fontsize : "12px", backgroundcolor : "#ffffff", color : "#000000"
},
markClass : {
borderwidth : "1", borderstyle : "outset", bordercolor : "#cecece",
fontfamily : "Arial", fontsize : "12px", backgroundcolor : "#ffffcc", color : "#000000"
},
currClass : {
borderwidth : "1", borderstyle : "solid", bordercolor : "#000000",
fontfamily : "Arial", fontsize : "12px", backgroundcolor : "#ffffcc", color : "#000000"
}
},
toolBar : {
height : 29,
bgcolor : "#bbbbbb",
defaultClass : {
bordercolor : "#bbbbbb", color : "#000000"
},
buttons : [
{
name : "addrowto",
img_on : {
src : "img/addrowto.gif", width : "16", height : "16"
},
img_off : {
src : "img/addrowto_off.gif", width : "16", height : "16"
},
text : "Add row before current one",
showMessage : true
},
{
name : "addrowafter",
img_on : {
src : "img/addrowafter.gif", width : "16", height : "16"
},
img_off : {
src : "img/addrowafter_off.gif", width : "16", height : "16"
},
text : "Add row after current one",
showMessage : true
},
{
name : "delrow",
img_on : {
src : "img/delrow.gif", width : "16", height : "16"
},
img_off : {
src : "img/delrow_off.gif", width : "16", height : "16"
},
text : "Delete row",
showMessage : true
},
{ }, //separator
{
name : "addcolto",
img_on : {
src : "img/addcolto.gif", width : "16", height : "16"
},
img_off : {
src : "img/addcolto_off.gif", width : "16", height : "16"
},
text : "Add column before current one",
showMessage : true
},
{
name : "addcolafter",
img_on : {
src : "img/addcolafter.gif", width : "16", height : "16"
},
img_off : {
src : "img/addcolafter_off.gif", width : "16", height : "16"
},
text : "Add column after current one",
showMessage : true
},
{
name : "delcol",
img_on : {
src : "img/delcol.gif", width : "16", height : "16"
},
img_off : {
src : "img/delcol_off.gif", width : "16", height : "16"
},
text : "Delete column",
showMessage : true
},
{ }, //separator
{
name : "copy",
img_on : {
src : "img/copy.gif", width : "16", height : "16"
},
img_off : {
src : "img/copy_off.gif", width : "16", height : "16"
},
text : "Copy",
showMessage : false
},
{
name : "paste",
img_on : {
src : "img/paste.gif", width : "16", height : "16"
},
img_off : {
src : "img/paste_off.gif", width : "16", height : "16"
},
text : "Pasting data from current cell",
showMessage : true
},
{ },
{
name : "sortasc",
img_on : {
src : "img/sortasc.gif", width : "16", height : "16"
},
img_off : {
src : "img/sortasc_off.gif", width : "16", height : "16"
},
text : "Sort data in current column in ascending order",
showMessage : true
},
{
name : "sortdesc",
img_on : {
src : "img/sortdesc.gif", width : "16", height : "16"
},
img_off : {
src : "img/sortdesc_off.gif", width : "16", height : "16"
},
text : "Sort data in current column in descending order",
showMessage : true
},
{
name : "multisortasc",
img_on : {
src : "img/multisortasc.gif", width : "16", height : "16"
},
img_off : {
src : "img/multisortasc_off.gif", width : "16", height : "16"
},
text : "Keep current order and sort data in current column in ascending order",
showMessage : true
},
{
name : "multisortdesc",
img_on : {
src : "img/multisortdesc.gif", width : "16", height : "16"
},
img_off : {
src : "img/multisortdesc_off.gif", width : "16", height : "16"
},
text : "Keep current order and sort data in current column in descending order",
showMessage : true
},
{
name : "resetsort",
img_on : {
src : "img/resetsort.gif", width : "16", height : "16"
},
img_off : {
src : "img/resetsort_off.gif", width : "16", height : "16"
},
text : "Reset sort",
showMessage : true
},
{ },
{
name : "formatbold",
img_on : {
src : "img/formatbold.gif", width : "16", height : "16"
},
img_off : {
src : "img/formatbold_off.gif", width : "16", height : "16"
},
text : "Format bold",
showMessage : false
},
{
name : "formatitalic",
img_on : {
src : "img/formatitalic.gif", width : "16", height : "16"
},
img_off : {
src : "img/formatitalic_off.gif", width : "16", height : "16"
},
text : "Format italic",
showMessage : false
},
{
name : "formatunderline",
img_on : {
src : "img/formatunderline.gif", width : "16", height : "16"
},
img_off : {
src : "img/formatunderline_off.gif", width : "16", height : "16"
},
text : "Format underline",
showMessage : false
},
{ },
{
name : "alignleft",
img_on : {
src : "img/alignleft.gif", width : "16", height : "16"
},
img_off : {
src : "img/alignleft_off.gif", width : "16", height : "16"
},
text : "Align left",
showMessage : false
},
{
name : "aligncenter",
img_on : {
src : "img/aligncenter.gif", width : "16", height : "16"
},
img_off : {
src : "img/aligncenter_off.gif", width : "16", height : "16"
},
text : "Align center",
showMessage : false
},
{
name : "alignright",
img_on : {
src : "img/alignright.gif", width : "16", height : "16"
},
img_off : {
src : "img/alignright_off.gif", width : "16", height : "16"
},
text : "Align right",
showMessage : false
},
{ },
{
name : "setamount",
img_on : {
src : "img/setamount.gif", width : "16", height : "16"
},
text : "Set count records per page",
showMessage : false
},
{ } ],
searchControl : {
text_on : "Search",
text_off : "Show all"
}
},
statusBar : {
height : 15,
bgcolor : "#bbbbbb",
defaultClass : {
color : "#000000", fontfamily : "Verdana", fontsize : "11px"
},
messageClass : {
color : "#0000ff", fontfamily : "Verdana", fontsize : "11px"
},
fieldText : "Field",
valueText : "Value"
}
};
|