Please find the response.
Query: “How can I use the value of other columns or fields (visible and invisible) to drive display logic inside the template?“
Based on the request, we have created a simple sample, please find the sample from the attachment.
In the provided sample, we have a template column named “Status Class” and another two non-template columns “StatusA” and “StatusB. We have rendered the template column based on the value of two non-template columns. The template used in the column Status Class is as follows
<script type="text/x-jsrender" id="columnTemp1"> <div class="img-container"> <img src="images/{{:StatusA}}.png" alt="Status A" title="Status A" /> <img src="images/{{:StatusB}}.png" alt="Status B" title="Status B" /> </div> </script>
|
We have used Batch editing and when value in the column StatusA or StatusB is changed, then the images in the column template will be changed using the cellSave event. Please refer the below code snippet.
function ChangeStatus(args) { //Function called using cellSave events var rowIndex = args.cell.closest("tr").index(); var gridObj = $("#Grid").data("ejGrid"); var temp = $.templates($("#columnTemp1").html()); args.rowData[args.columnName] = args.value; $(args.cell.closest("tr").get(0).childNodes[1]).html(temp.render(args.rowData)); //Set the template column value gridObj.setCellValue(rowIndex, args.columnName, args.value); }
|
Query: “Why does setting the column visible flag to false mess up the grid rendering?”
We have logged this as issue and the fix for this issue will be available in our upcoming Volume 1, 2014 release. But now we can provided the work around solution to resolve this “column mess up” issue by referring bootstrap.css in the sample.
Query: “How does the column isUnBound work - what does it mean and why does the grid stop working when I set it to true?”
The data you display in the Grid control will normally come from a data source of some kind, but you might want to display a column of data that does not come from the data source. This kind of column is called an unbound column.
Unbound columns are used to display custom content in the grid. For example, if you want to display some new columns like buttons to other parts of the grid, this feature will be useful.
The Unbound column must have the command property. We have checked your code snippet and suspect that you have not used the command property hence it stopped the grid rendering. For more details about command property, please refer the following online documentation and sample links.
Documentation : http://help.syncfusion.com/ug/js/Documents/commands.htm
Online sample : http://js.syncfusion.com/demos/#!/azure/grid/Editing/Command%20Column
Please let us know if you have any queries.
Regards,
Madhu Sudhanan. P