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");
    }
    }

  • 相关阅读:
    你拿什么保护我的版权(写在中移动MM商用之前)
    体验Windows Mobile 6.5 (模拟器)
    Mobile Market试用后感受
    制作Windows Mobile程序安装包
    自定义.NET CF控件,美化Windows Mobile程序界面
    记《虞美人盛开的山坡》
    剑风传奇 黄金时代篇1:霸王之卵
    发现IGame中又一个大坑
    【翻译】【西川善司】3D图形的概念和渲染管线(5回完)
    【翻译】西川善司为了3D游戏粉丝的[生化危机5]图形讲座(后篇)
  • 原文地址:https://www.cnblogs.com/archie2010/p/2128986.html
Copyright © 2011-2022 走看看