Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
SetCell removing formatter options
18/05/2010
08:21
Avatar
casperd
Member
Members
Forum Posts: 76
Member Since:
11/05/2009
sp_UserOfflineSmall Offline

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/05/2010
20:11
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

21/05/2010
08:14
Avatar
casperd
Member
Members
Forum Posts: 76
Member Since:
11/05/2009
sp_UserOfflineSmall Offline

Thanks, Tony.

What is the workaround?

24/05/2010
19:06
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

25/05/2010
02:52
Avatar
casperd
Member
Members
Forum Posts: 76
Member Since:
11/05/2009
sp_UserOfflineSmall Offline

Hi Tony,

I'm not editing the grid data. I would simply like to format my dates, as per my example above.

Also, waht is the problem with the following statement: $("#tblActiveProjects").setCell(rowid,'ProjectStatusDate',"","",{formatoptions:{newformat:'M Y'}});

Thanks!

25/05/2010
13:12
Avatar
casperd
Member
Members
Forum Posts: 76
Member Since:
11/05/2009
sp_UserOfflineSmall Offline

Hi Tony,

I have solved my own problem. I have used $("#tblActiveProjects").getCell(rowid,4) in my setCell statement. It wokred 100%.

Thanks!

Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information