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
This topic is locked No permission to create posts
sp_Feed Topic RSS sp_Related Related Topics sp_TopicIcon
Local Sorting Issue
17/11/2010
08:24
Avatar
casperd
Member
Members
Forum Posts: 76
Member Since:
11/05/2009
sp_UserOfflineSmall Offline

Hi Oleg,

When I put the alert(rowObject.childNodes[5].textContent); debug statement in the formatter function, it does return the values. It just seems to ignore it in the if (rowObject.childNodes[5].textContent == "True") condition. Any ideas?

Thanks,

Cas

17/11/2010
15:24
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Hi Cas,

I suppose there are a bug in your code. If you post the full code of your current example which reproduce your problem (or post a link to it) I could show it.

Regards
Oleg 

17/11/2010
15:44
Avatar
casperd
Member
Members
Forum Posts: 76
Member Since:
11/05/2009
sp_UserOfflineSmall Offline

Hi Oleg,

jqGrid Defaults:

            $.extend(jQuery.jgrid.defaults,{
                altRows: true,
                altclass: 'altRow',
                datatype: 'xml',
                emptyrecords: 'No records to display.',
                gridview: true,
                loadonce: true,
                loadui: 'disable',
                pgbuttons: false,
                pginput: false,
                //rowNum: -1,
                recordtext: '{2} items',
                sortable: true,
                viewrecords: true,
                viewsortcols: [false,'vertical',true]
            });

Grid definition:

            $("#tblActiveProjects").jqGrid({
                url:'../Data_Templates/DTM_Projects_Select.asp?FilterType=1&TeamMemberType=1',
                colNames: ['Prj. No.','Project Name', 'Status','RAG','Latest Update','','','','Issues','Risks','Changes','Defects',''],
                colModel: [
                    {name:'ProjectNumber', width:80, align:'center', sorttype:'text'},
                    {name:'ProjectName', width:445, align:'left', sorttype:'text', classes:'gridLink'},
                    {name:'ProjectStatus', width:90, align:'center', sorttype:'text'},
                    {name:'ProjectRAGIndicator', width:40, align:'center', sortable:false, formatter:RAG_formatter},
                    {name:'ProjectStatusDate', width:90, align:'center', sorttype:'date', formatter:OverdueDate_formatter, classes:'gridLink'},
                    {name:'IsOverdue', width:0, align:'center', hidden:true},
                    {name:'LinkToDashboard', width:0, align:'center', hidden:true},
                    {name:'LinkToWorkspace', width:0, align:'center', hidden:true},
                    {name:'ActiveIssues', width:50, align:'center', sorttype:'integer', classes:'gridLink'},
                    {name:'ActiveRisks', width:50, align:'center', sorttype:'integer', classes:'gridLink'},
                    {name:'ActiveChanges', width:50, align:'center', sorttype:'integer'},
                    {name:'ActiveDefects', width:50, align:'center', sorttype:'integer'},
                    {name:'Delete', width:25, align:'center', sortable:false, classes:'actionIcon', title:'Delete'}                    
                ],
                height: 90,
                sortname: 'ProjectName',
                pager: '#pagerActiveProjects',
                toolbar: [true,"top"],
                afterInsertRow: function(rowid, aData){
                    $("#tblActiveProjects").setCell(rowid,'ProjectName',"<a href='" + aData.LinkToWorkspace + "' target=_new title='Click the Project Name to open the Project Workspace'>" + aData.ProjectName + "</a>");
                    $("#tblActiveProjects").setCell(rowid,'ActiveRisks',"<a href='" + aData.LinkToWorkspace + "/Lists/Risks' target=_new title='Click to open the Project Risks list'>" + aData.ActiveRisks + "</a>");
                    $("#tblActiveProjects").setCell(rowid,'ActiveIssues',"<a href='" + aData.LinkToWorkspace + "/Lists/Issues' target=_new title='Click to open the Project Issues list'>" + aData.ActiveIssues + "</a>");
                    $("#tblActiveProjects").setCell(rowid,'Delete',"<img src='../Images/ButtonImages/delete_small.png' onclick=alert('" + rowid + "'); />");
                }
            });

Custom Formatter Fucntion:

OverdueDate_formatter = function (cellvalue, options, rowObject){
    if (rowObject.childNodes[5].textContent == "True"){
        return "<a href='Reports/RPT_Dashboard.asp?ReportProjectID=" + options.rowId + "' target=_new title='Progress Updates on this project is outdated! Click to open the latest Project Dashboard'>" + $.fmatter.util.DateFormat("m/d/Y",cellvalue,"d M Y",$.jgrid.formatter.date) + "</a>";
    }
    else{
        return "<a href='Reports/RPT_Dashboard.asp?ReportProjectID=" + options.rowId + "' target=_new title='Click to open the latest Project Dashboard'>" + $.fmatter.util.DateFormat("m/d/Y",cellvalue,"d M Y",$.jgrid.formatter.date) + "</a>";
    }
}

17/11/2010
17:37
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

It seems to me you should only replace

if (rowObject.childNodes[5].textContent == "True"){

to

if (rowObject.childNodes[5].text === "True") {

see the results. Of case to be able to use gridview: true you should use custom formatter for all coulumns which values you counstruct you currecntly inside of afterInsertRow.

Regards
Oleg

18/11/2010
07:04
Avatar
casperd
Member
Members
Forum Posts: 76
Member Since:
11/05/2009
sp_UserOfflineSmall Offline

Hi Oleg,

Using just the "text" property did not work. But the following code worked:

    if (rowObject.IsOverdue == undefined){
        if (rowObject.childNodes[5].textContent == "True"){
            return "<a href='Reports/RPT_Dashboard.asp?ReportProjectID=" + options.rowId + "' target=_new title='Progress Updates on this project is outdated! Click to open the latest Project Dashboard' class='gridOverdue' style='color:#FF0000;'>" + $.fmatter.util.DateFormat("m/d/Y",cellvalue,"d M Y",$.jgrid.formatter.date) + "</a>";
        }
        else{
            return "<a href='Reports/RPT_Dashboard.asp?ReportProjectID=" + options.rowId + "' target=_new title='Click to open the latest Project Dashboard'>" + $.fmatter.util.DateFormat("m/d/Y",cellvalue,"d M Y",$.jgrid.formatter.date) + "</a>";
        }
    }
    else{
        if (rowObject.IsOverdue == "True"){
            return "<a href='Reports/RPT_Dashboard.asp?ReportProjectID=" + options.rowId + "' target=_new title='Progress Updates on this project is outdated! Click to open the latest Project Dashboard' class='gridOverdue' style='color:#FF0000;'>" + $.fmatter.util.DateFormat("m/d/Y",cellvalue,"d M Y",$.jgrid.formatter.date) + "</a>";
        }
        else{
            return "<a href='Reports/RPT_Dashboard.asp?ReportProjectID=" + options.rowId + "' target=_new title='Click to open the latest Project Dashboard'>" + $.fmatter.util.DateFormat("m/d/Y",cellvalue,"d M Y",$.jgrid.formatter.date) + "</a>";
        }
    }

It seems when the grid is created, the childNodes[5] is available, but not thereafter. Then you can use the actual column name, e.g. "rowObject.IsOverdue".

Thanks for all your help!!

Cheers,

Cas

This topic is locked No permission to create posts
Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
48 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