问题描述
我需要一个列标题旁边的下拉列表。我通过在列的名称中添加适当的 HTML 来做到这一点:
列定义:
@objc func checkWrongOrRight(_ textField: UITextField) {
textField.attributedText = displayString(input: textField.text,expected: textLabel.text)
}
这很好用。但是,当网格重新呈现标题时,下拉列表将重置为默认值。
是否有可以用来设置所需值的回调(带有最后选择的选项的新 HTML)?
我可以阻止重新渲染标题吗?
提前致谢。
解决方法
好吧,如果其他人也面临同样的问题,我可以使用这种方法修复它:
开启
angularGridReady
this.angularGrid.gridStateService.onGridStateChanged.subscribe(()=>{
this.columnDefinitions.find(x=> x.id === "MyColumnId").name =
this.getDropdownHtml();
this.columnDefinitions = this.columnDefinitions.slice();
});
this.getDropdownHtml(); 是一种返回下拉列表(HTML 代码)并选择了最后一个选定值的方法。