EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: lorwynz_11 on March 03, 2014, 06:20:59 PM



Title: Blank Datagrid when using formatter
Post by: lorwynz_11 on March 03, 2014, 06:20:59 PM
Hi! I followed the code base in this tutorial:
 http://www.jeasyui.com/tutorial/datagrid/datagrid7.php  (http://www.jeasyui.com/tutorial/datagrid/datagrid7.php)

But when i applied it in my datagrid, it shows empty data.. All data are not loaded.. Why?


Here's my code:


HTML
Code:
					
<th field="osidate" sortable="true" auto="true" editor="text">OS Installed Date</th>
<th field="bdate" sortable="true" auto="true" editor="text" >BIOS Date</th>
<th field="pdate" sortable="true" auto="true" editor="text"  formatter="formatdate"  >Purchase Date</th>
<th field="process" sortable="true" auto="true" editor="text">Processor</th>
<th field="mobo" sortable="true" auto="true" editor="text">Motherboard</th>
<th field="memory" sortable="true" auto="true" editor="text">Memory Card</th>
<th field="drive" sortable="true" auto="true" editor="text">Hard Drive</th>
<th field="ups" sortable="true" auto="true" editor="text">UPS</th>


JScipt
Code:
     function formatdate(val,row){
var newval = val.slice(-4);
var d = new Date();
var n = d.getFullYear();

var finalval = n - newval;

if (finalval >= 5 ){
return '<span style="color:red;">'+val+'</span>';
} else {
return val;
}
}