0

The function works fine when calling like this.

 GenColumns({columns: [
 { headerText: "ID"},
 { headerText: "Doc"},
 { headerText: "Customer ID"}
 ] }]

But if I change to this, it doesn’t work.

 var col = [{ headerText: " ID", key: "D"},
 { headerText: "Doc"},
 { headerText: "Customer ID"}
 ];
 GenColumns({columns: [
 col
 ] })

How can I call function passing a generated string because "col" variable will be generated and does not type manually?

Thanks Wilson

asked Oct 2, 2013 at 7:42
2
  • 2
    GenColumns({columns: col}) Commented Oct 2, 2013 at 7:43
  • 1
    Change GenColumns({columns: [col] }) to GenColumns({columns: col }). col is already an array Commented Oct 2, 2013 at 7:43

3 Answers 3

1

This code

 var col = [{ headerText: " ID", key: "D"},
 { headerText: "Doc"},
 { headerText: "Customer ID"}
 ];
 GenColumns({columns: [
 col
 ] })

Is not the same as first one ... correct replacement is

 var col = [{ headerText: " ID", key: "D"},
 { headerText: "Doc"},
 { headerText: "Customer ID"}
 ];
 GenColumns({columns: col })

Because you duplicated the arrays. instead of columns : Array( Column ) you made columns : Array( Array( Column ))

answered Oct 2, 2013 at 7:44
Sign up to request clarification or add additional context in comments.

Comments

1

Instead of

GenColumns({columns: [ col ] })

Use

GenColumns({columns: col})

As col is already an array you just need to pass it.

answered Oct 2, 2013 at 7:44

Comments

0
var col = [{ headerText: " ID", key: "D"},
 { headerText: "Doc"},
 { headerText: "Customer ID"}
 ];
 GenColumns({columns: col})
answered Oct 2, 2013 at 7:44

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.