JavaScript table javs script table sort java script dynamic table script javascript in tables dhtml table object table actions get table data with javascript table examples data row column javascript table style arrays in javascript tables

PRODUCTS

JavaScript Projects

PHP Projects

Javascript Tools

SUPPORT

Standard vs PRO

FAQ

Contacts

Site Map

CODETHAT

Downloads

Users Testimonials

Our Customers

STUDIO   GRID   TABLE   MENU   TREE   XPBAR   HINT   EDITOR   TAB   FORM   CALENDAR   SCROLLER   SHOPPINGCART   TREEPHP   PACKER

User Manual

Introduction    Configure table look    Table decoration properties

Table general features    Table keys    User types    Data from the DB / CSV / XML / form

Using XML    Table reference    What's new?    Standard vs PRO

123Guide    Examples    Download

Themes

CODETHATTABLE USER MANUAL

User Types

Let new user type is named UserType.

And, for example, at content.js file it's need to specify the following functions and variables:

var USERTYPE_FORMAT = "";

//  Input : data : UserType,
//          format : String
//  Output:
//  if data can't be formatted (for example null) return DEFAULT_RESULT;
function formatUserType(data, format)
{
	return data;
}

//  Input : data : ANY
//  Output : if data can't be parsed return null;
function parseUserType(data)
{
	return data; //:UserType
}

//function that compare op1, op2 : UserType
function compareUserType(op1, op2)
{
	return result; //-1 (op1 < op2) | 0 (op1==op2) | 1 (op1 > op2)
}; 

Then you can use new user type at the column description.

Important - Please be careful writting type name!

Use upper case for all the letters at the format t ype string.

At the function names you should use the same letter case as for type name, which is used at the type field.

Example code:

var EMAIL1_FORMAT = " !";
function formatEmail1(data, format) {
	return data + " " + format;
};

function parseEmail1(data) {
	return "! " + data;
};

function compareEmail1(op1, op2) {
	if (Undef(op1) && Undef(op2)) return 0;
	else if (Undef(op1)) return 1;
	else if (Undef(op2)) return - 1;
	op1 = op1.toUpperCase();
	op2 = op2.toUpperCase();
	if (op1 > op2) return 1;
	else if (op1 < op2) return - 1;
	else return 0;
};
...
var gridDef =
{
	...
	colDef : ARRAY == [
	{
		title : "E-mail",
		titleClass : "",
		type : "Email1",
		width : 0,
		alignment : "center",
		compareFunction : compareEmail1,
		isVisible : true,
		useAutoIndex : false,
		useAutoFilter : false
	},
	...

Example - Email as new usertype

You can see an example and complete code here - Email as new usertype [popup]

Read more about CodeThatTable >>

[ Home ]  [ Contacts ]  [ Site Map ]  [ News ]  [ Links ]  [ Downloads ]

[ Go Top ]

© CodeThat.com, 2003-2009
Design by XTLabs, Inc
Sponsored by Rocket Division Software, LTD.