Cannot pass an array of object to a function?

Random I.T

I am trying to pass the selected values from a dropdown menu to a handleSearch() then this pass to a filterList().

However, it does not reach to filterList().

private handleSearch(e) {
    let key = e.key;
    let val = e.target.value;
    let type = e.target.type;
    let tname = e.target.name;
///code above
 if (type == "select-one") {
      let opt = [{ name: tname, value: val }]; //e.g. [{name:"Category",value:"abc"}]
      debugger;
      let page;
      this.filterList(
        this.state.searchvalue,
        page,
        this.state.selectVal ? this.state.selectVal : opt
      );
///code below
/// I can read the data here 
 private filterList(query: string, ItemsPerPage = 10, options?) {
    let category = "";
    let users = "";
    let orderby = "Title";
    let order = "asc";
    if (options) { // undefined
      for (let i = 0; i <= options.length; i++) {
        if (options.name == "Category") {
/// codes continue
<select name="Category" onChange={props.select}>
  <option value="">All Category</option>
  {cat.map(i => (
    <option value={i}>{i}</option>
  ))}
</select>;

props.select is defined as select={this.handleSearch} in the Parent Component Did I miss something?

Random I.T

I know why > < i am looping a for loop. thus

 if (options.name == "Category") {

should be

 if (options[i].name == "Category") {

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Cannot pass array object from map function as argument javascript

From Dev

cannot pass array in a function javascript

From Dev

How to pass object array to a function?

From Dev

Pass object array into member function

From Dev

Cannot pass an array to a function from a multidimensional array

From Dev

cannot pass float array out of a function

From Dev

React .map is not a function but cannot pass array

From Dev

How to pass literal object array to function?

From Dev

Cannot pass jQuery object.method to another function to be executed

From Dev

Cannot pass multi-dimensional array to C function in *.pyx

From Dev

Cannot pass 2d array into a helper function in c++

From Dev

How can I pass an array to a function that cannot modify it?

From Dev

How to pass a function with arguments via JavaScript object array?

From Dev

How to pass array object in the onResponse function of Acitivity to Fragment?

From Dev

Pass reference of array of unknown type (Either Object or Primitive) to function

From Dev

Cannot pass JSON array to array

From Dev

Pass object[] into a function in PowerShell

From Dev

Pass object through function

From Dev

Pass Object to Function Method

From Dev

Pass an Object Through a Function

From Dev

Pass a operator = to a function object

From Dev

Pass object as function arguments

From Dev

Pass object to event function

From Dev

Pass an object into an array in JavaScript

From Dev

Pass array of object to curl

From Dev

Pass in object and array variables

From Dev

Cannot pass object data to modal

From Dev

Pass array of class as array of object

From Dev

Pass struct array to function

Related Related

HotTag

Archive