zoukankan      html  css  js  c++  java
  • DHTMLX GRID数据连接

    DHTMLX GRID数据连接

    所依赖的类

    import java.sql.Connection;
    import java.util.HashMap;
    import java.util.Iterator;

    /**
    * The Class GridConnector.
    */
    public class GridConnector extends BaseConnector {

    /** The extra info , which need to be mixed in output */
    protected StringBuffer extra_output = new StringBuffer();

    /** The collections of options */
    protected HashMap<String,BaseConnector> options = new HashMap<String,BaseConnector>();

    /**
    * Instantiates a new grid connector.
    *
    *
    @param db the db connection
    */
    public GridConnector(Connection db){
    this(db,DBType.Custom);
    }

    /**
    * Instantiates a new grid connector.
    *
    *
    @param db the db connection
    *
    @param db_type the db type
    */
    public GridConnector(Connection db, DBType db_type){
    this(db,db_type, new GridFactory());
    }

    /**
    * Instantiates a new grid connector.
    *
    *
    @param db the db connection
    *
    @param db_type the db type
    *
    @param a_factory the class factory, which will be used by object
    */
    public GridConnector(Connection db, DBType db_type, BaseFactory a_factory){
    super(db,db_type,a_factory);
    }

    .....................

    创建本地数据库连接

    Connection conn= null;
    try {

    //获得数据库连接
    conn = ConnectionManager.getConnection();

    //Dhtmlx连接
    GridConnector c = new GridConnector(conn,DBType.MSSQL);

    DHTMLX支持当前主流的数据库

     * The Enum DBType.
    *
    * Stores supported DB types
    */
    public enum DBType {

    /** The Common SQL. */
    SQL,
    /** The MySql. */
    MySQL,
    /** The Oracle. */
    Oracle,
    /** The MSSQL. */
    MSSQL,
    /** The PostgreSql. */
    PostgreSQL,
    /** The Custom DB type ( will be defined by class factory ) */
    Custom
    }

    查询方式

    import java.sql.Connection;

    import com.dhtmlx.connector.*;


    // TODO: Auto-generated Javadoc
    /**

    * The Class SQLBasicConnector.
    */
    public class Grid_01a_SQLBasicConnector extends ConnectorServlet {

    /* (non-Javadoc)
    * @see com.dhtmlx.connector.ConnectorServlet#configure()
    */
    @Override
    protected void configure() {
    Connection conn
    = ( new DataBaseConnection()).getConnection();

    GridConnector c
    = new GridConnector(conn);
    c.dynamic_loading(
    100);//加载100条数据
    //标识主键,列出与前台所关联的字段
    c.render_sql(
    "SELECT grid50000.item_id as ID , grid50000.item_nm FROM grid50000",
    "item_id(ID)","grid50000.item_id(ID),item_nm");
    }
    }

  • 相关阅读:
    构造函数与其他方法的区别
    记录点复习题目和linux学习
    找点面试题目
    linux代码常用查询!!!!!!!!!!!!
    python复习
    明天面试今天赶紧准备下
    文都计算机考研课程
    是时候刷笔试题目了
    倒排索引
    总结算法课程
  • 原文地址:https://www.cnblogs.com/archie2010/p/2128986.html
Copyright © 2011-2022 走看看