jQuery MiniUI

标题: 关于datagrid控件里的数据验证 [打印本页]

作者: wao110    时间: 2016-7-21 13:15:31     标题: 关于datagrid控件里的数据验证

[attach]7691[/attach]
如上图所示 想给地区加上必填 损失电量必填整数

代码如下

<div id="datagrid1" class="mini-datagrid" style="width: 98%;"
        idField="id" allowResize="false" pageSize="20" allowCellEdit="true"
        allowCellSelect="true" multiSelect="true" editNextOnEnterKey="true"
        editNextRowCell="true" showPager="false"
        url="<%=basePath%>/powerlossmx/list.do?POWERLOSS_ID=${pd.POWERLOSS_ID}&action=${msg}" >
                <div property="columns">
                <div name="action" headerAlign="center" align="center" renderer="onActionRenderer" headerStyle="background-color: #e5e6e6;"  width="5%">
                <img src="static/images/add.gif" width="16" height="16" alt="新增" class="hand" />
        </div>
                        <div type="indexcolumn" headerStyle="background-color: #e5e6e6;" width="5%">序号</div>
                        <div name="AREA" field="AREA" headerAlign="center"
                                align="center" headerStyle="background-color: #e5e6e6;" width="30%">地区
                                <input property="editor" class="mini-combobox"
                                data = "[{id:'库尔勒',text:'库尔勒'},{id:'轮台',text:'轮台'},{id:'尉犁',text:'尉犁'},{id:'若羌',text:'若羌'},{id:'博湖',text:'博湖'}
                                ,{id:'和静',text:'和静'},{id:'焉耆',text:'焉耆'},{id:'且末',text:'且末'},{id:'和硕',text:'和硕'}]"  style="width:100%;"  required="true"/>
                        </div>
                        <div name="LOSSVALUE" field="LOSSVALUE"
                                headerAlign="center" align="center"
                                headerStyle="background-color: #e5e6e6;" width="60%">损失电量
                                <input property="editor" class="mini-spinner" minValue="-999999999" maxValue="9999999999" required="true" vtype="float"/>
                        </div>
                </div>
</div>

尝试过将 required="true" vtype="int"但是都不起作用 倒是浮点型能用

作者: felt    时间: 2016-7-21 13:56:59

表格的验证请参考这个示例
http://www.miniui.com/demo/#src=datagrid/cellvalidation.html
效果是背景色提示
1 表格设置allowCellValid="true"
2 列上设置vtype
<div name="AREA" field="AREA" headerAlign="center" vtype="required" type="comboboxcolumn"
<div name="LOSSVALUE" field="LOSSVALUE" vtype="int"





欢迎光临 jQuery MiniUI (http://miniui.com/discuss/) Powered by Discuz! X2