I have created a jqGrid that contains some fields such as:
job_id, name, etc
What I am trying to do is make so that when the click on the value in the job_id column, it will redirect them to:
job.php?job_id=(value that they clicked on)
I started by trying to use the following as my colModel:
{ name:'job_id', index:'job_id', edittype:'select', formatter:'showlink',
formatoptions:{baseLinkUrl:'job.php'}, width:50, align:'center' }
But what this results in is a redirection to:
job.php?job_id=(row_id)
I did some searching, and found a post by the developer of the open source version of this software who suggested using the following colModel and additional JS:
{ name:'job_id', index:'job_id', edittype:'select', formatter:'showlink',
formatoptions:{baseLinkUrl:'#'}, width:50, align:'center' }
loadComplete: function() {
var myGrid = $("#home_list");
var ids = myGrid.getDataIDs();
for (var i = 0, idCount = ids.length; i < idCount; i++) {
$("#"+ids[i]+" a",myGrid[0]).click(function(e) {
var hash=e.currentTarget.hash;// string like "#?id=0"
if (hash.substring(0,5) === '#?id=') {
var id = hash.substring(5,hash.length);
var text = this.textContent;
location.href="job.php?id="+text;
}
e.preventDefault();
});
}
}
But this is not compatible with IE. In addition to this, when displaying a large number of rows in the jqGrid, it takes a extremely long time to load, say 5 seconds + for 500 rows.
I'm going to keep working on this, but is this something that anyone else has done?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…