X5的模糊查询和下拉框

最近在做X5方面的工作。由于网络上关于X5的资料比较少,所以想把自己学习的基础都记录下来,希望和大家多多交流!

第一步  建ontology

第二步  建process

第三步  建XUI模板,进行配置

第四步  在修改windows文件。。

主要就是这一步。我把代码粘上(具体下拉框和模糊查询都写在下面代码的步骤里面了)

 

代码
<?xml version="1.0" encoding="UTF-8"?>

<!--
            ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   
            ;    category       :     JS版本
            ;    type         :    列表详细线型码表
            ;    version     :    1.0
            ;     author        :    zhuyi 
            ;    date        :    2010-06-01 16:23:42
            ;    company        :    justep
            ;    description    : 
            ;      modifylog    : 
            ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;                                                 
            
-->
<window xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xforms="http://www.w3.org/2002/xforms"
    xmlns:ev
="http://www.w3.org/2001/xml-events" xmlns:f="http://orbeon.org/oxf/xml/formatting"
    xmlns:widget
="http://orbeon.org/oxf/xml/widget" xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
    xmlns:justep
="http://www.justep.com/x5#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:ns
="http://www.justep.com/x5#"
    xmlns:data
="http://www.justep.com/x5/xui/data#"
    xmlns:ajx
="http://www.ajaxforms.net/2006/ajx" main-data="main" id="startActivity"
    navigator-id
="TT_Bookinfo_navigatorId" justep-id="main-window"
    activity
="startActivity" xforms-engine="client" init-biz-param="true"
    cacheable
="true">  
  
<!-- 定义主数据-->
    
<data id="main" offset="1" limit="20" justep-id="maindata"
        default-sort
="justep:fBookName|asc">
        
<concept concept="justep:TT_Bookinfo" justep-id="mainconcept">
            
<relation relation="justep:fBookName" />
            
<relation relation="justep:fBookISBN" />
<!--    下拉框----1  alias所绑定关系的   别名-->
            
<relation relation="justep:fBookType">
                
<concept concept="justep:TT_MainBookType">
                    
<relation relation="justep:fMainBookTypeName" alias="mainBookTypeName">
                    
</relation>
                
</concept>
            
</relation>
            
<relation relation="justep:fBookPicture" />
        
</concept>
        
<rule justep-id="maindatarule"></rule>
    
</data>
<!--    模糊查询----1  -->
    
<data id="selectBook" type="constant"
        columnids
="fBookName,condition"
        store-type
="simple">
        
<rows>
            
<row>
                
<cell></cell>
                
<cell></cell>
            
</row>
        
</rows>
    
</data>

  <!--定义其他数据——静态-->
    
<action name="xui-insert" is-to-tree="false">
        
<view position="linecode-detail" />
    
</action>  
  
<!--设置工具条-->
    
<view id="_actions" navigator-id="linecode-list-navigator">
        
<control id="toolbarCtrl">
            
<xhtml:div width="100%"
                component
="/justep/components/standard_bar/standardbar.xui.xbl.xml#bar">
                
<toolbar name="general-bar" />
                
<toolbar name="record-bar" />
            
</xhtml:div>
        
</control>
    
</view>
<!--    模糊查询----2  -->
    
<view id="selectView">
        
<control id="selectControl">
            
<xhtml:table>
                
<xhtml:tr>
                    
<xhtml:td>
                        
<xforms:label>书名</xforms:label>
                    
</xhtml:td>
                    
<xhtml:td>
                        
<xforms:input data:ref="xui-data('selectBook')/justep:fBookName" />
                    
</xhtml:td>
                    
<xhtml:td>
                        
<xforms:trigger>
                            
<xforms:label>查询</xforms:label>
                            
<xforms:action ev:event="DOMActivate">
                                
<xxforms:script>
                                
<![CDATA[
                                    var filter = new Array();
                                    
                                    var BookName = commonUtils.getValueFromInstance("selectBook", "fBookName");
                                    if(BookName != "") filter.push("fBookName LIKE http://www.w3.org/2001/XMLSchema#string:%"+ BookName +"%");
                                    
                                    commonUtils.setValueToInstance("selectBook","condition",filter.join(" and "));
                                
]]>
                                
</xxforms:script>
                                
<xforms:setvalue data:ref="xui-data(main,query)/value"
                                    data:value
="instance('selectBook')/condition"
                                    data:index
="index('xui-data-id(main,query)','name','_filter_')" />
                                
<xui-refresh />
                            
</xforms:action>
                        
</xforms:trigger>
                    
</xhtml:td>
                
</xhtml:tr>
            
</xhtml:table>
        
</control>
    
</view>
  
<!--设置列表-->
    
<view id="linecodeListView">
        
<control id="gridCtrl">
<!-- 如果添加数据的时候在列表页面的话,就把div编程可编辑的,也就是 editMode=“true” 文本框的type=“ed”  -->
            
<xhtml:div data="main" id="main_grid" width="100%" height="100%"
                component
="/justep/components/grid/grid.xui.xbl.xml#grid" justep-id="list" editMode="true">
                
<xforms:action ev:event="xxforms-row-dblclick">
                    
<xforms:toggle case="linecode-detail" />
                
</xforms:action>
                
<justep:column ref="fBookName" type="ed" />
                
<justep:column ref="fBookISBN" type="ed" />
<!--    下拉框----3  -->
                
<justep:column label="图书主类别" width="110" ref="mainBookTypeName"
                    type
="select" editor-id="select-id-specialtype"></justep:column>
                
<justep:column ref="fBookPicture" type="ed" />
            
</xhtml:div>
<!--    下拉框----4 各项属性要和前面绑定的对清楚了 -->
            
<xhtml:div component="/UI/system/components_client/data_select.xml#list"
                data:ref
="xui-data('main')/justep:fBookType"
                data:label-ref
="xui-data('main')/justep:mainBookTypeName"
                concept
="TT_MainBookType"
                display
="fMainBookTypeName"
                navigator-id
="select-id-specialtype" />
        
</control>
        
<layout>
            
<object path="gridCtrl" />
        
</layout>
    
</view>
    
<view justep-id="_detail" id="_detail">
        
<control id="fBookName">
            
<xforms:input data:ref="xui-data('main')/justep:fBookName" />
        
</control>
        
<control id="fBookISBN">
            
<xforms:input data:ref="xui-data('main')/justep:fBookISBN" />
        
</control>
        
<control id="fBookType">
            
<xhtml:div component="/UI/system/components_client/data_select.xml#list"
                data:ref
="xui-data('main')/justep:fBookType"
                data:label-ref
="xui-data('main')/justep:mainBookTypeName"
                concept
="TT_MainBookType"
                display
="fMainBookTypeName"
                
/>
        
</control>
        
<control id="fBookPicture">
            
<xforms:input data:ref="xui-data('main')/justep:fBookPicture" />
        
</control>
        
<layout src="xianshi.layout.xls" />
    
</view>
    
<layout justep-id="main_layout">
        
<xhtml:div component="/UI/system/components_client/tabs.xml#tabs">
            
<justep:tab id="linecode-list">
                
<justep:label>列表</justep:label>
                
<xhtml:table border="0" width="100%" height="100%">
                    
<xhtml:tr height="20">
                        
<xhtml:td>
                            
<object path="selectView" />
                        
</xhtml:td>
                    
</xhtml:tr>
                    
<xhtml:tr>
                        
<xhtml:td class="custom-toolbar-background" height="20">
                            
<object path="_actions" />
                        
</xhtml:td>
                    
</xhtml:tr>
                    
<xhtml:tr>
                        
<xhtml:td>
                            
<object path="linecodeListView" />
                        
</xhtml:td>
                    
</xhtml:tr>
                
</xhtml:table>
            
</justep:tab>
            
<justep:tab id="linecode-detail">
                
<justep:label>详细</justep:label>
                
<xhtml:table>
                    
<xhtml:tr>
                        
<xhtml:td class="custom-toolbar-background" height="20">
                            
<object path="_actions" />
                        
</xhtml:td>
                    
</xhtml:tr>
                    
<xhtml:tr>
                        
<xhtml:td>
                            
<object path="_detail" />
                        
</xhtml:td>
                    
</xhtml:tr>
                
</xhtml:table>
            
</justep:tab>
        
</xhtml:div>
    
</layout>
</window>

 


 

posted @ 2010-06-02 18:10  朱漪  阅读(1190)  评论(1编辑  收藏  举报