SMART datagrid v.1 > Concepts
Concepts.DataLudi Class System
SMART datagrid module is implemented with several models and various structures within their relations. It is designed in the way of object-oriented programming (OOP) to resolve the complexity, and internally defines Class models of SMART datagrid itself to implement the design. Although SMART datagrid developer does not have to know the details of module inside, since the internal structure can be broken very simply due to the characteristics of JavaScript, he should follow several rules below.
- Several rules for using SMART datagrid module properly
- All classes inherit DLBase class.
- The class is conceptually composed of Property, Method and Callback events.
- One property can have getter and setter. Read-only property does not have setter.
- getter name of property is the same as property name. setter name has the prefix "set" in front of property name.
Example) getter is GridHeader.minHeight() and setter is setMinHeight() in GridHeader minHeight property.
Example) getter is GridHeader.visible() in GridHeader visible property.
var h = grid.header().minHeight();
grid.header().setVisible(!grid.header().visible());
Properties can use DLBase.assign function to change the value as configuration object.grid.header().assign({ minHeight: 30, visible: true });
assign method is called within most object property setter.grid.setHeader({ minHeight: 30, visible: true });
If specify the basic type (Number, Boolean, String) value with assign parameter, it will be specified as Basic Property of the object.Basic property will be explained in each class API document. If there is no basic property, assign call will be ignored.grid.header().assign(true);
or,grid.setHeader(true);
Properties can use DLBase.getProperty, getProperties, setProperty, setProperties to approach property path.var visible = grid.getProperty('header.visible');
grid.setProperty('header.visible', value);
In order to use the function above, "." should not be included in property name.Event callback name starts with "on".grid.onCurrentChanged = function (grid, newIndex) {};
You should never store or update the variable which starts with underline or "$".You should never call the function or method which starts with underline or "$".You should not use the method or property which is unreleased in API document.Although type flexibility of JavaScript can be an advantage, it can also be a big risk when develop business system. You must follow data types of parameter or return value which have been specified in API.