注意datagrid使用的触发函数是:

onBeginEdit,只有在这个触发条件下,editor才真正初始化完成,不然没法动态修改numberbox中的最大最小值。

示例代码:(注意这一块:onBeginEdit:changeNumberMax)

<table id="dg"  style="width:960px;height:auto"
data-options="
singleSelect: true,
url: '<%=request.getContextPath() %>/settlementRule/relatedServices?prodId=${productDto.prodId }',
method:'get',
onLoadSuccess:checkData,
onBeginEdit:changeNumberMax
">
<thead>
<tr>
<th data-options="field:'id',width:150,hidden:true">规则ID</th>
<th data-options="field:'createTime',width:150,hidden:true">规则创建时间</th>
<th data-options="field:'prodSrvId',width:150,hidden:true">服务ID</th>
<th data-options="field:'srvName',width:150">服务名称</th>
<th data-options="field:'srvCode',width:150">服务编号</th>
<th data-options="field:'providerName',width:150">所属厂商</th>
<th data-options="field:'srvTypeDesc',width:108">服务类型</th>
<th data-options="field:'rate',width:100,formatter:function(value,row){if(value!=null&&value!=0) {return value+'%';}}">分摊比例</th>
<th data-options="field:'ruleType',width:150,formatter:function(value,row){if(value==${FIXED_ACCOUNT_SETTLEMENT}) {return '固定金额结算'} else if(value==${PROPORTION_SETTLEMENT}) { return '按比例结算'} },
editor:{type:'combobox',options:{url: '<%=request.getContextPath() %>/settlementRule/getSettlementRuleTypeEnums',valueField:'enumEntryValue',textField:'enumEntryLabel',
method:'get',editable:'true',panelHeight: 'auto',required:'true',editable:false}}">结算类型</th>
<th data-options="field:'val',width:150,formatter:function(value,row){if(value!=null){if(row.ruleType==${PROPORTION_SETTLEMENT}) {return value+'%';} else if(row.ruleType==${FIXED_ACCOUNT_SETTLEMENT}) {return value;}}},editor:{type:'numberbox',options:{required:'true',min:0,precision:2}}">结算规则</th>
</tr>
</thead>
</table>

相应的触发函数:

function  changeNumberMax(rowIndex,rowData)  {
var ruleType=rowData.ruleType;
if(ruleType==0) {
var sharePercent=rowData.rate;
var ed = $('#dg').datagrid('getEditor', {index:rowIndex,field:'val'});
$(ed.target).numberbox({
max: ${productDto.prodPrice }*sharePercent/100,
precision: 2,
min:0
});
}
}

  

动态修改datagrid中的numberbox的最大值和最小值的更多相关文章

  1. Java反射机制可以动态修改实例中final修饰的成员变量吗?

    问题:Java反射机制可以动态修改实例中final修饰的成员变量吗? 回答是分两种情况的. 1. 当final修饰的成员变量在定义的时候就初始化了值,那么java反射机制就已经不能动态修改它的值了. ...

  2. IOS 加载Xib 后 如何 动态修改xib中的控件frame

    看看xib里view是不是设置了自动布局 use auto layout.取消掉就可以了.

  3. Android——修改Button样式,动态修改Button中的图片大小

    原文地址: http://www.cnblogs.com/gzggyy/archive/2013/05/17/3083218.html http://www.xuebuyuan.com/2173740 ...

  4. net5:动态修改内存中的站点地图节点

    原文发布时间为:2008-07-29 -- 来源于本人的百度文章 [由搬家工具导入] using System;using System.Data;using System.Configuration ...

  5. C#中关于DateTime的最大值和最小值

    System.DateTime的最小可能值:DateTime.MinValue.ToString()=0001-1-1 0:00:00 我们实际用的时候会指定一个默认值DateTime.Parse(& ...

  6. 写一个函数,将一个int型的数组做为参数传入,使用指针返回两个结果:最大值和最小值

    今日下午研究了一下c语言中的指针问题,c语言的核心是指针,指针的核心是地址,地址的核心是内存. #include <stdio.h> void hanshu(int *arry,int s ...

  7. JQuery easyUi datagrid 中 editor 动态设置最大值最小值

    前言 近来项目中使用到 easyui 来进行页面设计,感觉挺方便的,但是网上除了api外,其他有价值的资料比较少,故在此分享一点经验,供大家参考.   问题 JQuery easyUi datagri ...

  8. easyui datagrid动态修改editor时动态绑定combobox的数据

    需求在 datagrid 编辑框中开启一个combobox  ,但是里面的数据需要开启的时候才会知道,数据会根据其他因数变更 参考原文 :http://blog.csdn.net/donggua369 ...

  9. Easyui Datagrid 的Combobox 如何动态修改下拉选项,以及值的转换

    我是先将下拉选项的值通过datagrid的url查出来了,在每一行的row中 //项目结果选项卡的列表    $('#project_table').datagrid({        width : ...

随机推荐

  1. 关于swagger文档的使用方法

    引言 最近在后台开发的时候,使用swagger2进行前后台接口文档的声明.由此遇见的一些问题,写下来给自己复习. 参考: https://blog.csdn.net/xupeng874395012/a ...

  2. 剑指offer第五章

    剑指offer第五章 1.数组中出现次数超过一半的数 数组中有一个数字出现的次数超过数组长度的一半,请找出这个数字. 例如输入一个长度为9的数组{1,2,3,2,2,2,5,4,2}.由于数字2在数组 ...

  3. LeetCode 739. Daily Temperatures

    原题链接在这里:https://leetcode.com/problems/daily-temperatures/description/ 题目: Given a list of daily temp ...

  4. python之wheel 包命名规则、abi 兼容和安装

    一.windows安装python包,遇见的问题 1.python3以后的版本,安装python包,可以直接使用pip安装,但是安装时偶尔报错 2.安装python源码包,如何确定自己该安装哪个版本, ...

  5. Sprint第一个冲刺(第一天)

    一.Sprint介绍 我们这次的团队项目是做<餐厅到店点餐系统>APP版,暂时不是基于用户需求来做的,但后期会进行用户需求调查,完善我们的软件.现在正在做一些前期准备,在团队合作上还缺乏一 ...

  6. c++ queue 用法

    最重要的是: queue 和 stack 都没有迭代器!!! 1. push 队列中由于是先进先出,push即在队尾插入一个元素. 2. pop 将队列中最靠前位置的元素拿掉,和push都是没有返回值 ...

  7. python模块--logging

    一.logging模块的简单应用 import logging logging.debug('debug message') logging.info('ingo message') logging. ...

  8. grpc gateway 使用以及docker compose 集成

    1. grpc gateway 安装 参考,比较简单,有需要的依赖可以参考相资料 mkdir tmp cd tmp git clone https://github.com/google/protob ...

  9. groovy && java 混编 gradle 配置

    参考配置: apply plugin: "application" apply plugin: "java" apply plugin: "groov ...

  10. hapi lab测试框架简单使用

    1. 依赖安装 yarn init yarn add lab code 2. 基本模式 const Lab = require('lab'); const Code = require('code') ...