RowTemplate in ejGrid from string
setting a rowtemplate from a string doesn't seem to work properly
$("#Grid").ejGrid({
// the datasource "window.employeeData" is referred from templatelocaldata.js
dataSource: window.employeeData,
allowScrolling: true,
scrollSettings: { height: 380, width: 500 },
rowTemplate: "Hello {{:FirstName}} {{:LastName}} ", /*"#templateData",*/
columns: [
{ headerText: "Photo", width: 30 },
{ headerText: 'Employee Details', width: 70 }
]
});
// the datasource "window.employeeData" is referred from templatelocaldata.js
dataSource: window.employeeData,
allowScrolling: true,
scrollSettings: { height: 380, width: 500 },
rowTemplate: "
columns: [
{ headerText: "Photo", width: 30 },
{ headerText: 'Employee Details', width: 70 }
]
});
SIGN IN To post a reply.
3 Replies
VN
Vignesh Natarajan
Syncfusion Team
October 11, 2017 02:30 AM UTC
Hi Michael,
Thanks for Using Syncfusion products
We have analyzed your query and rowTemplate property of Grid is used to bind the id of the HTML template. A string value cannot be assigned to rowTemplate as you mentinoed.
Please refer the below code snippet
|
<script id="hello" type="text/x-jsrender">
<tr>
<td>
Hello {{:FirstName}} {{:LastName}}
</td>
<td>
Welcome
</td>
</tr>
</script>
.
.
.
.
scrollSettings: { height: 380, width: 500 },
rowTemplate: "#hello",
columns: [
{ headerText: "Photo", width: 30 },
{ headerText: 'Employee Details', width: 70 }
] |
Please refer the JSplayground sample
Please refer our online documentation on rowTemplate
Regards,
Vignesh Natarajan
MS
Michael Salzlechner
October 11, 2017 02:35 AM UTC
is there any other way to create dynamic templates?
VN
Vignesh Natarajan
Syncfusion Team
October 12, 2017 12:14 PM UTC
Hi Micheal,
We have analyzed your query to create dynamic templates using rowTemplate feature. So, we have logged a usability feature ”Script error is thrown when template string provided instead of Id in rowTemplate”. The issue will be fixed and it will be included in 2017 Volume 4, which is expected to be rolled out in the month of November 2017.
Regards,
Vignesh Natarajan
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
MS Michael Salzlechner
- Oct 9, 2017 01:58 PM UTC
- Oct 12, 2017 12:14 PM UTC