Forum


08:21

11/05/2009

Hi,
My code:
$("#tblActiveProjects").jqGrid({
url:'../Data_Templates/DTM_Projects_Select.asp?FilterType=1&TeamMemberType=1',
colNames: ['Prj. No.','Project Name', 'Status','RAG','Latest Update','',''],
colModel: [
{name:'ProjectNumber', width:80, align:'center', sorttype:'text'},
{name:'ProjectName', width:300, align:'left', sorttype:'text'},
{name:'ProjectStatus', width:100, align:'center', sorttype:'text'},
{name:'ProjectRAGIndicator', width:60, align:'center', sortable:false, formatter:RAG_formatter},
{name:'ProjectStatusDate', width:90, align:'center', sorttype:'date', formatter:'date', formatoptions:{srcformat: 'y/m/d', newformat:'d M Y'}},
{name:'LinkToDashboard', width:30, align:'center', hidden:true},
{name:'LinkToWorkspace', width:30, align:'center', hidden:true}
],
height: 155,
sortname: 'ProjectName',
pager: '#pagerActiveProjects',
gridview: false,
afterInsertRow: function(rowid, aData){
$("#tblActiveProjects").setCell(rowid,'ProjectStatusDate',"<a href='PG_Dashboard.asp?ReportProjectID=" + rowid + "' target=_new title='Click the Latest Update Date to open then Project Dashboard'>" + aData.ProjectStatusDate + "</a>","gridLink");
}
});
The following issue:
1) I use the prededfined "date" formatter to format the column "ProjectStatusDate";
2) I use the setCell method to add a link to the "ProjectStatusDate" column after the row insert;
3) If I use this setCell method I lose the "d M Y" formatting on this column. The dates are not displayed as '18 May 2010', but as '2010/05/18'.
4) If I don't use the setCell mthod, the dates are displayed correctly.
Any ideas?
Thanks!
20:11

Moderators
30/10/2007

Hello,
This is only valid for formatter date. There is a workground on this, but it will be changed in the 3.7 release.
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
19:06

Moderators
30/10/2007

Hello,
The workground is as follow.
Suppose you have a formatter date which converts certain format to other one into the grid. The display date into the grid is the same as the editred one. In setCell, addRowData and setRowData we do not convert the date back to its original format (if formatter is available) since we should do the following when we are in editing mode:
1. convert the date to srcformat after the cell is edited
2. convert then the date from srcformat to newformat using the build in formatter
3. put the converted date into the grid.
This means the following operatins:
A => B => A
Convert A to B and then B to A which does not have sence
I do not know if I explain it Ok.
Instead with the these functions regarding the date is: what you put, is what you see.
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
62 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66