当前位置:编程学习 > JAVA >>

Ext中grid实现模糊查询

在action中find_all方法中,加入以下代码:

[java] 
//根据输入的查询字模糊查询 
        if(searchWord!=null && !"".equals(searchWord)){ 
            if(condition ==null){ 
                condition = new Condition(); 
            } 
            ConditionRule cr1 = new ConditionRule("sysName",searchWord,Condition.Mode.CONTAIN,Condition.Type.AND); 
            ConditionRule cr2 = new ConditionRule("projectName",searchWord,Condition.Mode.CONTAIN,Condition.Type.OR); 
            ConditionRuleGroup crg = new ConditionRuleGroup(); 
            crg.addRule(cr1,cr2); 
            condition.addRuleGroup(crg); 
        } 

若想实现时间排序,按照时间最近的在前面:
Ordinal ordinal= OrdinalUtil.createOrdinal(this,new String []{"creatorDate:DESC"},null);

补充:软件开发 , Java ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,