8.嵌入Freeform
8.1 普通嵌入
Supcan Treelist允许嵌入一个Freeform XML,来代替行的显示,相当于每行都是一个Freeform.嵌入 Freeform 的 Treelist 不支持以树展现、不支持合计/小计行.
被嵌入的 Freeform 不支持 Menus、Upload、Pager、ImageFlow 类型的 Object.
8.2 Freeform对话框
有一种常见的应用场景是,数据平常以Treelist列表展现,如果要修改数据,只要按回车键(或鼠标双击),就能弹出一个对话框,在对话框中输入数据。<Properties editFreeformId="FR1"/> <cols> <col ...> ... </cols> <FreeformRes> <freeform id="FR1" url="freeform71.xml" IdOk="ok" IdCancel="cancel" extWidth="0"/> <freeform id="FR2" url="freeform72.xml" IdOk="ok" IdCancel="cancel" extWidth="0"/> </FreeformRes> ...这种对话框有2种形式的freeform:
<?xml version="1.0" encoding="utf-8"?> <!--Supcan Freeform --> <freeform> <Properties bgColor="#ffffff"> <Expresses> 〈Copy/〉 //注:Expresses(表达式)将从 Treelist 复制 </Expresses> <Validations> 〈Copy/〉 //注:Validations(验证)将从 Treelist 复制 </Validations> </Properties> <Fonts> <Font height="-13"/> </Fonts> <Objects> <TableLayout x="5" y="42" width="95%"> <Col width=".1"/> <Col width="90"/> <Col width="6"/> <Col width="190"/> <Col width="30"/> <Col width="90"/> <Col width="6"/> <Col width="190"/> <Col width=".1"/> 〈repeat〉 //注:本段内容将动态生成,里面有2个input, 表示垂直是双排的 <tr height="24"> <td/> <td><input width="3" leftTextAlign="left"/></td> <td/> <td/> <td/> <td><input width="3" leftTextAlign="left"/></td> </tr> <tr height="6"/> 〈/repeat〉 </TableLayout> <groupEx x1="5" y1="5" width="99%" y2=".bottom+8" text=" 请输入 "/> <input id="ok" Text="确认" x="36%" y=".bottom+10" width="80" type="button" /> <input id="cancel" Text="取消" x=".right+10" y=".top" width="80" type="button" /> </Objects> <DropLists> 〈Copy/〉 //注:Droplists(下拉资源)将从 Treelist 复制 </DropLists> </freeform>里面核心的部分就是<TableLayout>中的那段<repeat> ... </repeat>,其中的<input>只能含有width、leftTextAlign属性,不能书写其它的属性.