像过滤器这样的Excel应用于行而不是带有primeng DataTable的列

时间:2016-12-22 21:51:47

标签: angular primeng

我使用http://www.primefaces.org/primeng/#/datatable/filter中给出的代码创建了类似过滤器的excel,但它被应用于行而不是列。以下是使用的代码。

Connection con = null;
        Statement stmt = null;
        ResultSet rs = null;
        try {
            Class.forName("net.sourceforge.jtds.jdbc.Driver");
            con = DriverManager.getConnection("jdbc:jtds:sqlserver://ServerName;instance=SQLEXPRESS","username","password");

            String sql = "select * from DB2.dbo.Table1 where [Field1] IS NULL";     
                stmt = con.createStatement();
                rs = stmt.executeQuery(sql);
                //Add in all info
                while (rs.next()){
                    beanResultsList.addBean(new Bean(
                            rs.getInt(1),
                            rs.getString(2),
                            rs.getString(3),
                            rs.getDate(4),
                            rs.getDate(5),
                            rs.getInt(6),
                            rs.getInt(7),
                            rs.getInt(8),
                            rs.getInt(9),
                            rs.getString(10),
                            rs.getString(11),
                            rs.getString(12),
                            rs.getString(13)
                            )); 
                }
                } catch (SQLException | NamingException e) {
                    e.printStackTrace();
                }finally{
                    try { con.close();  } catch (SQLException e) {}
                    try { rs.close();   } catch (SQLException | NullPointerException e) {}
                    try { stmt.close(); } catch (SQLException e) {}
                } // End finally (try catch)

0 个答案:

没有答案