Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/22.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 react jsonschema form extra asynctypeahead,设置初始值_Reactjs_React Bootstrap Typeahead - Fatal编程技术网

Reactjs react jsonschema form extra asynctypeahead,设置初始值

Reactjs react jsonschema form extra asynctypeahead,设置初始值,reactjs,react-bootstrap-typeahead,Reactjs,React Bootstrap Typeahead,如何在react jsonschema form extra asynctypeahead中从db设置初始值? 我可以在db中保存所选元素的ID,但当我返回带有加载值的表单时,typeahead字段为空 这是我的代码: user: { "ui:field": "asyncTypeahead", asyncTypeahead: { url: "https://jsonplaceholder.typicode.com/users", minLength:

如何在react jsonschema form extra asynctypeahead中从db设置初始值? 我可以在db中保存所选元素的ID,但当我返回带有加载值的表单时,typeahead字段为空

这是我的代码:

  user: {
    "ui:field": "asyncTypeahead",
    asyncTypeahead: {
      url: "https://jsonplaceholder.typicode.com/users",
      minLength: 1,
      //selected: {'username':'Bret'},
      selected: {'name':'Leanne Graham'},
      mapping: 'id',
      selectHintOnEnter: true,
      //labelKey: "username",
      labelKey: (option) => `${option.name} ${option.username}`,
      //overrideOptions: true
    }
  }

有人能帮我吗?

你能发布你的React代码吗?这里是完整的代码:无论如何,我们认为方法是在选项中预取数据。