Check documentation for the latest version of dhtmlxSuite Data Loading HowTos DHTMLX Docs

Data Loading HowTos

How can I enable dynamic loading?

To enable dynamic loading you should:

  • enable the related mode on the client side (e.g. smart rendering or paging for grid)
grid.enableSmartRendering(mode,buffer);
  • call the method dynamic_loading() on the server side
conn.dynamic_loading(rowsNum);

See the guide 'Dynamic loading' for more information.

How can I format/change data before loading?

To set some specific formatting or change data before sending to the client side, you should use the beforeRender event handler. For more details on this topic, see the 'Formatting/Changing Data before Loading' chapter.

class RenderBehavior extends ConnectorBehavior{
    public void beforeRender(DataItem data) {
        if (data->get_index() % 2 == 1 )
            data.set_row_color("red");
    } 
}
 
grid.event.attach(new RenderBehavior());

How can I load data from a database table?

To load data from a database table you should use one of two methods:

  • render_table() (for loading from a single table)
grid.render_table("grid50","item_id","item_nm,item_cd", "extra1, extra2");
  • render_sql() (for loading from several tables)
grid.render_sql(
    "SELECT * from tableA INNER JOIN tableB  ON tableA.id=tableB.id", 
    "",
    "name,price", 
    "extra1, extra2"
);

How can I send additional information to the client side?

To send to the client side additional information that won't be outputted, but you'll have access to, use the fourth(optional) parameter of the render_table() method. There you should specify columns that contain the desired additional information.

grid.render_table("some_table","id","name,price","color,count");

For more information, see the chapter 'Using extra fields' in the 'Formatting/Changing Data before Loading' guide.

Back to top