zoukankan      html  css  js  c++  java
  • ext的radiogroup和checkgroup的setvalues

    radiogroup和checkgroup重写的方法,实现了setvalues

     1Ext.override(Ext.form.CheckboxGroup, {
     2  getNames: function() {
     3    var n = [];
     4
     5    this.items.each(function(item) {
     6      if (item.getValue()) {
     7        n.push(item.getName());
     8      }

     9    }
    );
    10
    11    return n;
    12  }
    ,
    13
    14  getValues: function() {
    15    var v = [];
    16
    17    this.items.each(function(item) {
    18      if (item.getValue()) {
    19        v.push(item.getRawValue());
    20      }

    21    }
    );
    22
    23    return v;
    24  }
    ,
    25
    26  setValues: function(v) {
    27    var r = new RegExp('(' + v.join('|'+ ')');
    28
    29    this.items.each(function(item) {
    30      item.setValue(r.test(item.getRawValue()));
    31    }
    );
    32  }

    33}
    );
    34
    35Ext.override(Ext.form.RadioGroup, {
    36  getName: function() {
    37    return this.items.first().getName();
    38  }
    ,
    39
    40  getValue: function() {
    41    var v;
    42
    43    this.items.each(function(item) {
    44      v = item.getRawValue();
    45      return !item.getValue();
    46    }
    );
    47
    48    return v;
    49  }
    ,
    50
    51  setValue: function(v) {
    52    this.items.each(function(item) {
    53      item.setValue(item.getRawValue() == v);
    54    }
    );
    55  }

    56}
    );

  • 相关阅读:
    NPM
    Angular2.0快速开始
    AngularJS常用插件与指令收集
    Linq 操作基础
    SQL Server2008 with(lock)用法
    SQL Server2008 MERGE指令用法
    SQL Server2008 表旋转(pivot)技术
    ef to sqlite 实际开发问题终极解决方法
    windows控件常用缩写
    SQL 查询总结
  • 原文地址:https://www.cnblogs.com/sxlfybb/p/1394956.html
Copyright © 2011-2022 走看看