Forum
10:54
05/02/2009
Hi Tony, I just upgraded the grid to the latest 3.5 version... lots of stuff that has changed - thanks alot!
Some issues though that I came across as I upgraded: (my grid code is at the bottom)
1. I am getting a horizontal scrollbar showing up on the grid and I can slide it little bit to the right. (I don't want it) Previously this was not a problem. I am also getting a vertical scrollbar, but I want that since I am showing 50 records at a time.
2. I remember in the last version, there was some bug regarding datatype:local/json. I had to use local back then, but now json is finally working (Thank you!). However, for some reason, when I set it to json, Firefox complains (from firebug) as following:
uncaught exception: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIXMLHttpRequest.open]" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame :: http://dev.site.com/boxfixrate2/Solo/Solo/Hero/WebCore/JS/jquery-1.3.2.min.js :: anonymous :: line 19" data: no]
3. Is there any way I can make sorting default to descending (instead of ascending). A good example is the column Modified Date. Users are usually interested in seeing the newest date first when sorting this field (hence, they want descending order when they click the sort column). Have you implemented thsi feature? If not, is there a workaround?
Thanks alot for your help. Here is my grid code for reference:
jQuery("#list").jqGrid({
url: '',
datatype: 'json',
mtype: 'POST',
celledit: false,
colNames: ['Id', 'Rel', 'Name', 'Skills', 'Desired Role', 'City', 'St', 'Desired Sal.', 'Last Modified', 'WA', 'Edu', 'DET', 'SEC'],
colModel: [
{ name: 'id', index: 'id', hidden: true },
{ name: 'score', index: 'score', sorttype: 'int', hidden: true },
{ name: 'fullname', index: 'fullname', edittype: 'text', sorttype: 'text', width: 124 },
{ name: 'skillcount', index: 'skillcount', width: 50, align: 'right' },
{ name: 'desiredrolestring', index: 'desiredrolestring', width: 140 },
{ name: 'city', index: 'city', width: 85 },
{ name: 'state', index: 'state', width: 45 },
{ name: 'desiredsalaryratetohour', index: 'desiredsalaryratetohour', sorttype: 'text', width: 95, align: 'right' },
{ name: 'modified', index: 'modified', width: 100, align: 'center' },
{ name: 'workauthorization', index: 'workauthorization', width: 55 },
{ name: 'highestdegree', index: 'highestdegree', width: 50 },
{ name: 'desiredemptype', index: 'desiredemptype', width: 65 },
{ name: 'securitylevel', index: 'securitylevel', width: 45}],
height: "400px",
jsonReader: {
root: "profiles",
page: "curPage",
total: "totalPageCount",
records: "recordCount",
repeatitems: false
},
loadui: 'disable',
pager: jQuery('#pager'),
sortname: 'score',
sortorder: "desc",
onPaging: function(pgButton) {
setTimeout(function() { getSearchResults(1); }, 1);
},
onSortCol: function(index, colindex, sortorder) {
jQuery("#list").setGridParam({ page: 1 });
setTimeout(function() { getSearchResults(1); }, 1);
},
afterInsertRow: function(rowid, rowdata, rowelem) {
var link = '<a href="../Profile/ViewProfile.aspx?kid=' + rowid + '&mode=1&k=' + encodeURIComponent(cur_keywords) + '" target="_blank">' + rowdata.fullname + '</a>';
jQuery("#list").setCell(rowid, 'fullname', link, {});
var relScore = Math.ceil(rowdata.score * 100); //double number, 1 is 100%, 0.45 is 45%
jQuery("#list").setCell(rowid, 'score', relScore + '%', {});
if (rowdata.securitylevel == 'No')
jQuery("#list").setCell(rowid, 'securitylevel', 'N/A');
var skills = '';
if (rowdata.skillcount == null || rowdata.skillcount == '')
skills = '- ';
else
skills = '<a style="padding-right:7px" id="sk' + rowid + '" href="javascript:showSeekerSkills(\'' + rowid + '\');">' + rowdata.skillcount + '</a>'
jQuery("#list").setCell(rowid, 'skillcount', skills, {});
},
rowNum: 50,
rownumbers: true,
rowList: [],
viewrecords: true,
width: 955,
shrinkToFit: true,
imgpath: '../../images/jqgrid',
caption: ''
});
21:53
05/02/2009
Hi Tony,
the url parameter is still giving me headaches. It looks like when you have a json/POST situation, things do not work correctly.
If I leave url blank (or leave it out), there will be some javascript/ajax errors (as previously mentioned above). However, if I put in something in that url parameter, the error goes away. However, when I put my app live on the server, it will POST to that url everytime I ask something from the server, which is very unfortunate and slows down everything (and makes an unnecessary post call)
Any suggestions?
Thanks,
Thor.
03:09
Moderators
30/10/2007
Hello,
I think that all is correct. If you have json datatype you should have a valid url. If you do not want to use url you should use datatype set to local. Try not to use other plugins - just jqGrid and try (this is for 2).
About 3. I will think, but the options array in the grid is going bigger and bigger (which I do not want to happen).
Best 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.
08:56
05/02/2009
Tony,
Alright, local works ok, the only thing that bothers me is that whenever I sort, it starts sorting the local data (50 rows) and the list flickers and then it goes ahead and does the sort from the server and list flickers again with correct results.
Can I get rid of this local unneccessary/annoying sorting?
Thanks,
Thor.
Most Users Ever Online: 715
Currently Online:
58 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