Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 在表格内进行反应和设计选择_Reactjs_Antd - Fatal编程技术网

Reactjs 在表格内进行反应和设计选择

Reactjs 在表格内进行反应和设计选择,reactjs,antd,Reactjs,Antd,我无法获取要填充的选定值以及antd表中此列的标题 在数据库中,索引=AccountNumber,关键字值=102,这是帐号。未设置初始负载。帐号在可用值的下拉列表中,但未设置。页面最初加载时为空 这样加载页面,但没有为查找选择值。 我希望它是这样的,因为测试的原因,它是硬编码到“帐号”的值。事实上,我希望它像查找一样被填充,其中keyvalue 102=帐号 这是表中的选择下拉列表。该表有两列。 表的数据源是selecteIndexTypeKeyTypes,它是此类的IEnumerabl

我无法获取要填充的选定值以及antd表中此列的标题

在数据库中,索引=AccountNumber,关键字值=102,这是帐号。未设置初始负载。帐号在可用值的下拉列表中,但未设置。页面最初加载时为空

这样加载页面,但没有为查找选择值。

我希望它是这样的,因为测试的原因,它是硬编码到“帐号”的值。事实上,我希望它像查找一样被填充,其中keyvalue 102=帐号

这是表中的选择下拉列表。该表有两列。
表的数据源是selecteIndexTypeKeyTypes,它是此类的IEnumerable

下拉列表的数据源是此类的IEnumerable

更新:
可能使用defaultValue或initialValue属性


管理员
卖方
顾客

{getFieldDecorator('roleList'{
初始值:user.roleList | |[],
规则:[
{必需:false,消息:“为此用户分配角色”,键入:“数组”},
],
})(
管理员
卖方
顾客
)}

传递到
选择
组件的
属性意味着是所需
选项
子项的相应
属性。不仅仅是一个文本值。将代码更改为以下内容:

constructor(props) {
   super(props);
   this.state = {
       selectValue: "initial-value",
       ...
   };
}

...
<Select
  value={desKeywordTypeList.length ? (desKeywordTypeList.find(r => /account\snumber/i.test(r.keywordTypeName)) || {}).keywordTypeId : this.state.selectValue}
  onChange={...}>
   {
      desKeywordTypeList.length ? desKeywordTypeList.map(record => (
      <Option key={record.keywordTypeID} value={record.keywordTypeID}>
        {record.keywordTypeName} ({record.keywordTypeID})
      </Option>
      :
      <Option value={this.state.selectValue} key={this.state.selectValue} >Account Number</Option>
   }
</Select>
构造函数(道具){
超级(道具);
此.state={
选择值:“初始值”,
...
};
}
...
/account\snumber/i.test(r.keywordTypeName))| |{}.keywordTypeId:this.state.selectValue}
onChange={…}>
{
desKeywordTypeList.length?desKeywordTypeList.map(记录=>(
{record.keywordTypeName}({record.keywordTypeID})
:
帐号
}

如何硬编码值或value=“初始值”?这是从数据库加载的。当前它是record.keywordTypeId?请您建议任何代码笔。每个表行的此值都会更改。好的,我明白了。我不能用它制作有用的代码笔,因为它取决于您的数据被提取。我已经编辑了我的答案,但谢谢您的帮助。我的屏幕看起来像它应该的样子。U修正问题