To enable dynamic loading you should:
grid.enableSmartRendering(mode,buffer);
dhtmlxTreeConnector treeConnector = new dhtmlxTreeConnector(/*.....*/);
treeConnector.EnableDynamicLoading = true;
dhtmlxGridConnector gridConnector = new dhtmlxGridConnector(/*.....*/);
gridConnector.SetDynamicLoading(30);
See the guide 'Dynamic loading' for more information.
To set some specific formatting or change data before sending to the client side, you should use the ItemPrerender event handler. For more details on this topic, see 'Formatting/Changing Data before Loading'
connector.ItemPrerender += new EventHandler<ItemPrerenderEventArgs<dhtmlxGridDataItem>>(
connector_ItemPrerender
);
void connector_ItemPrerender(object sender,ItemPrerenderEventArgs<dhtmlxGridDataItem> e)
{
if (e.DataItem.Index % 2 == 0)
e.DataItem.BgColor = "gray";
}
To load data from a database table you should use one of two ways:
dhtmlxGridConnector connector = new dhtmlxGridConnector(
"SELECT ISO, PrintableName FROM Country",
"UID",
dhtmlxDatabaseAdapterType.SqlServer2005,
ConfigurationManager.ConnectionStrings["SamplesDatabase"].ConnectionString
);
dhtmlxGridConnector connector = new dhtmlxGridConnector(
"BookStore",
"sales, title, author, price, instore, shipping, bestseller, pub_date",
"book_id",
dhtmlxDatabaseAdapterType.SqlServer2005,
ConfigurationManager.ConnectionStrings["SamplesDatabase"].ConnectionString
);
To send additional information that won't be outputed but you'll have access to, to the client side, use the optional constructor parameter - ExtraColumnNames. With the help of this param, you can specify the columns that contain the desired additional information.
dhtmlxGridConnector connector = new dhtmlxGridConnector(
//SQL with inner join statement
"SELECT UID,
PrintableName,
TimeZone,
TZID FROM Country INNER JOIN Timezone ON Country.TZID = Timezone.TZID",
"UID",//Primary key name
dhtmlxDatabaseAdapterType.SqlServer2005, //Database adapter type
//connection string
ConfigurationManager.ConnectionStrings["SamplesDatabase"].ConnectionString,
"TZID"//This column will be requested, appear in all events, but won't be rendered
);
For more information, see the chapter 'Using extra fields' in the 'Basic Loading' guide.
Back to top