Reputation: 1368
I have a multi-line text in one of the cells in kendo grid. Kendo template works fine for simple text but not for text which have a new line or next line(\n)
or multi-line. There might be some problem in template code.
Here is the edit template in grid
{ field: "", title: "Action", sortable: true, headerTemplate: createHeaderTemplate1("Action"),
template: '<a onclick="EditStatus(${StatusId},${ReasonId},${EmployeeId},"${Description}", "${DescriptionDate}")"
class="tdEdit margin-right10" title="Edit">Edit</a>' }
Below function gets called in all the cases except if Description field in the grid have multi-line.
function EditStatus(StatusId,ReasonId,EmployeeId ,Description,DescriptionDate)
{
// to Do
}
How multiline text it appears in fire bug:
<a onclick="EditStatus(50162, 2,27,"This is new comment to test.
But we need to check difference between space and enter.
Here and then save it.", "Sat Jun 10 2017 00:00:00 GMT+0530 (India Standard Time)")" class="tdEdit margin-right10" title="Edit">Edit</a>
whereas in the case when there is no multiline, it works fine and it shows like below in browser
<a onclick="EditStatus(50157, 1,27,"hi", "Mon Jun 05 2017 00:00:00 GMT+0530 (India Standard Time)")" class="tdEdit margin-right10" title="Edit">Edit</a>
Upvotes: 0
Views: 967
Reputation: 3872
Try this:
template: '<a onclick="EditStatus(${StatusId},${ReasonId},${EmployeeId},`"${Description}"`, "${DescriptionDate}")" class="tdEdit margin-right10" title="Edit">Edit</a>'
I added backticks (`) to enclose the Description argument.
Upvotes: 2