jQuery MiniUI

 找回密码
 立即注册
查看: 1737|回复: 1
打印 上一主题 下一主题

关于datagrid控件里的数据验证 [复制链接]

Rank: 1

跳转到指定楼层
楼主
发表于 2016-7-21 13:15:31 |只看该作者 |倒序浏览

如上图所示 想给地区加上必填 损失电量必填整数

代码如下

<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"但是都不起作用 倒是浮点型能用
附件: 你需要登录才可以下载或查看附件。没有帐号?立即注册

Rank: 8Rank: 8

沙发
发表于 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"

Archiver|普加软件

GMT+8, 2024-9-30 04:17 , Processed in 1.021451 second(s), 11 queries .

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部