[Grid] ??

2011-12-27 14:46:24by ??
                
<a:grid id="grid" bindTarget="sys_prompt_result_ds" height="400" marginHeight="200" marginWidth="50"
 navBar="true" width="800">
     <a:toolBar>
          <a:button type="add"/>
          <a:button type="delete"/>
          <a:button type="save"/>
     </a:toolBar>
     <a:columns>
          <a:column name="prompt_code" editorFunction="promptCodeEditFunction" sortable="true" width="350"/>
          <a:column name="language_display" editorFunction="languageEditFunction" width="100"/>
          <a:column name="description" editor="sys_prompt_result_grid_tf" width="300"/>
     </a:columns>
     <a:editors>
          <a:textField id="sys_prompt_result_grid_tf"/>
          <a:textField id="sys_prompt_result_grid_upper_tf" typeCase="upper"/>
          <a:comboBox id="sys_prompt_result_grid_comboBox"/>
     </a:editors>
</a:grid>
      

此例中涉及到的grid属性讲解如下


bindTarget:说明其绑定的dataset。
marginWidth、marginHeight:与页面布局有关的属性,详细请查阅HTML标准。
未提到的属性信息,请参阅“Aurora Tag Documentation”文档

此例中涉及到的grid中的子节点介绍如下:
toolbar:工具条,常用的有增加、保存、删除。此三按钮如果仅仅声明type属性,则默认行为为调用绑定dataset的对应行为。
columns:数据列,说明要显示的结果列。
name:  显示的列名。比如当有结果名为user时,若name=”user”,则将值显示在此列。
sortable:表明可以按此列排序(当鼠标点击该列的标题时进行排序)。当此列数据为子查询结果时不可用,否则会引发异常。
editorFunction:指定一个处理函数,可以对数据的可编辑性进行控制。比如在此例中,业务要求是当建立了一个prompt记录的时候,其code和语言类型均不可再被编辑。此属性对应的是一个js函数名,当业务逻辑允许该列修改数据时,可以在js中返回一个编辑器的ID,如果不允许修改,返回空即可。
      

                
            function promptCodeEditFunction(record, name) {
                if (record.get('prompt_id')) {
                    return '';
                } else {
                    return 'sys_prompt_result_grid_upper_tf';
                }
            }
      

editors:编辑器。其子节点的类型指定编辑器的类型,id为该编辑器的id

Demo
    Attachments

      Comments

      0 Responses to the article

      暂时没有评论。

      发表评论