Forum



19:23

26/04/2011

Hi, I'm new to using javascript, jqGrid and jQuery. What I'm trying to acheive is the ability to use a link in my jqgrid, to open a new tab, that will be populated with a new jqGrid.
I have mimiced the jqgrid demo site, and have the left treegrid menu operating and creating new tabs, with jqgrids dynamically. I can see the code in the treegrid for the links but have been unsuccessful in trying to embed this logic in my gridview.
You can see code in action here: http://demo.qualitytrack.com/report
By viewing source you should be able to see any code. Any inut would be appreciated.
Mike
19:23

26/04/2011

Okay I'm almost there. I have create a new grid in tab working using the OnSelectRow.
But I need to get this to work utilizing individual cells or icons. I've not been able to find a simale function as OnSelectRow for a single cell.
Here is my code:
<script type="text/javascript">
var mygrid = jQuery("#calllisting2").jqGrid({
url: 'server.php?q=calllisting',
datatype: "json",
mtype: "GET",
height: 400,
width: 750,
colNames:["id","Call#","View","Region","Sales Office", "Team", "Manager", "Property", "Period", "Call Date", "Score"],
colModel:[
{name: 'id',index:'id', width:1,hidden:true,key:true},
{name: 'callnumber',index:'callnumber', width:55, align:"right"},
{name: 'view', width: 30, sortable: false, search: false, align: "center",
formatter:function(cellvalue){
return "<a class='ui-icon ui-icon-document' >View Call Report</a>";
}},
{name: 'region',index:'region', width:80, align:"left",
stype:'select', editoptions:{value:":All;<?php
echo $region;
?>"} },
{name: 'salesoffice',index:'salesoffice', width:80, align:"left",
stype:'select', editoptions:{value:":All;<?php
echo $salesoffice;
?>"} },
{name: 'manager',index:'manager', width:80, align:"left",
stype:'select', editoptions:{value:":All;<?php
echo $manager;
?>"} },
{name: 'agent',index:'agent', width:120, align:"left",
stype:'select', editoptions:{value:":All;<?php
echo $agent;
?>"} },
{name: 'property',index:'property', width:70, align:"left",
stype:'select', editoptions:{value:":All;<?php
echo $property;
?>"} },
{name: 'periodid',index:'periodid', width:60, align:"center", stype:'select',
editoptions:{value:":All;2007-02:2007-02;2007-03:2007-03"}},
{name: 'reportdate',index:'reportdate', width:70, align:"center", sorttype:'date', datefmt:"Y-m-d",
searchoptions:{dataInit:function(el){$(el).datepicker({dateFormat:'yyyy-mm-dd'});} }},
{name: 'score',index:'score', width:54, align:"right", sorttype:'number', formatter:'number',formatoptions:{decimalPlaces:1, suffix: " %"} }
],
rowNum: 50,
rowList : [20,30,50,100],
rownumbers: true,
rownumWidth: 40,
gridview: true,
sortname: 'callnumber',
viewrecords: true,
sortorder: "asc",
pager : "#pcalllisting2",
userdata: "userdata",
caption: "Call Listing Report",
recordtext: "View {0} - {1} of {2} <span id=avgscore>Avg Score 100%</span>",
emptyrecords: "No records to view <span id=avgscore>Avg Score 100%</span>",
loadComplete: function printAvg() {
var txt = document.getElementById('avgscore');
txt.innerHTML = "Avg: "+jQuery("#calllisting2").jqGrid('getGridParam', 'userData' )['avgscore'] +" %";
},
onSelectRow: function(rowid) {
var rowdata = $("#calllisting2").jqGrid('getRowData',rowid);
var callurl = "./calldetail.php?callnumber="+rowdata.callnumber;
var st = "#t"+rowdata.callnumber;
if($(st).html() != null ) {
maintab.tabs('select',st);
} else {
maintab.tabs('add',st, rowdata.callnumber);
$.ajax({
url: callurl,
type: "GET",
dataType: "html",
complete : function (req, err) {
$(st,"#tabs").append(req.responseText);
$(st,"#tabs");
}
});
}
}
});
Most Users Ever Online: 715
Currently Online:
52 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