https://jsfiddle.net/gh/get/jquery/1.9.1/IgniteUI/help-samples/tree/master/16.2/EN/grid/column-template/fiddle
In the above example at line number 11('deleteRow(${ProductID})') it works.
However if i try to pass a string it fails(onclick='deleteRow(${ProductNumber})' )
How to pass string?
Hello Akhi,
I am glad that you find my suggestion helpful.
Thank you for using Infragistics components.
Thank you Vasya...i had tried adding "'",should have tried "\".
Your explanation is fantastic.Appreciate the support.
When using a string value to pass the template (onclick='deleteRow(${ProductNumber})') you need to add quotation marks in order to treat the value ${ProductNumber} as a string, not as a variable with the same name - ProductNumber . For example:
columns: [ { headerText: "Product ID", key: "ProductID", dataType: "number", width: "10%" }, { headerText: "Product Name", key: "Name", dataType: "string", width: "30%" }, { headerText: "Product Number", key: "ProductNumber", dataType: "string", width: "25%" }, { headerText: "Make Flag", key: "MakeFlag", dataType: "bool", width: "15%" }, { headerText: "", key: "Delete", dataType: "string", width: "20%", unbound: true, template: "<input type='button' onclick='deleteRow(\"${ProductNumber}\")' value='Delete row' class='delete-button'/>" } ]
Additionally, you have to change the primary key to point to the string column.
primaryKey: "ProductNumber"
I modified the fiddle and it can be found at:
https://jsfiddle.net/jzkpvv3L/6/
Please let me know if you need any further assistance with this matter.
Thank you for posting in our community.
I am currently looking into this matter for you and I will update you on my findings.
Please feel free to continue sending updates to this case at any time.
For more clarity i have put an alert
Working on passing ProductID
https://jsfiddle.net/jzkpvv3L/1/
(DATATYPE number)
Not working on passing ProductNumber
(STRING TYPE)
https://jsfiddle.net/jzkpvv3L/2/