Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修正默认选中值无效BUG #115

Open
qinggan opened this issue Dec 14, 2022 · 0 comments
Open

修正默认选中值无效BUG #115

qinggan opened this issue Dec 14, 2022 · 0 comments

Comments

@qinggan
Copy link

qinggan commented Dec 14, 2022

在 868 行起至 898 行改成:

    if (p.multiple) {
      self.prop.init_set = true
      //self.clearAll(self)
      $.each(data, function (i, row) {
        var item = { text: getText(row), value: row[p.keyField] }
        if (self.isAlreadySelected(self, item)) self.addNewTag(self, row, item)
      })
      self.tagValuesSet(self)
      self.inputResize(self)
      self.prop.init_set = false
    } else {
	    var row = {};
	    for(var i in data){
		    if(data[i][p.keyField] == p.initRecord){
			    row = data[i];
			    break;
		    }
	    }
      //var row = data[0]
      self.elem.combo_input.val(getText(row))
      self.elem.hidden.val(row[p.keyField])
      self.prop.prev_value = getText(row)
      self.prop.selected_text = getText(row)
      if (p.selectOnly) {
        self.elem.combo_input
          .attr('title', self.message.select_ok)
          .removeClass(css.select_ng)
          .addClass(css.select_ok)
      }
      self.putClearButton()
    }

多选模式去除:
self.clearAll(self)
同时将:
if (!self.isAlreadySelected(self, item)) self.addNewTag(self, row, item)
改成:
if (self.isAlreadySelected(self, item)) self.addNewTag(self, row, item)

单选模式将:
var row = data[0]
注释掉,然后补上以下代码:

var row = {};
for(var i in data){
  if(data[i][p.keyField] == p.initRecord){
    row = data[i];
    break;
  }
}

即可修正!希望官网更新啊~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant