Hi
I need to get the multiple values in single key
For example
var northwindEmployees = [{ "ID": 1, "Name": "Davolio, Nancy", "Title": "Sales Representative", "ImageUrl": "../../images/samples/nw/employees/1.png", "Phone": "(206) 555-9857", "PhoneUrl": "tel:(206) 555-9857", "BirthDate": "\/Date(480808800000)\/", "HireDate": "\/Date(1224795600000)\/", "Country": "USA", "Languages": [{ name: "English" }, { name: "Russian" }] }]$("#grid1").igGrid({dataSource: northwindEmployees,primaryKey: "ID",width: "100%",height: "500px",autoGenerateColumns: false,columns: [{ headerText: "Image", key: "ImageUrl", dataType: "string", template: "" },{ headerText: "Name", key: "Name", dataType: "string" },{ headerText: "Title", key: "Title", dataType: "string" },{ headerText: "Phone", key: "Phone", dataType: "string" },{ headerText: "Hire Date", key: "HireDate", dataType: "date" },{ headerText: "Languages", key: "Languages", dataType: "string", template: "${Languages}" }
i need the languages like (English,Russian) in my grid please help methanks.
Hello Robin,
Currently there is no way to bind the grid to a data source containing complex objects. However you can set up a formatter function that will render the grid in the way you want but you won't really be able to use much of the functionality available to columns with simple properties (such as editing, filtering, etc.).
In your columns definition try to replace the "Languages" definition with the following:
{ headerText: "Languages", key: "Languages", dataType: "object", formatter: function(val){return val[0].name+", "+val[1].name}}
I hope this helps! Please, let me know if you have any other questions and/or concerns!
Regards,
Tsanna