Forum
04:57
26/04/2012
Hi I wrote this on help forum few days ago but didnt get any feedbacks...
And I still think its a bug
so gonna write here again...
---------------------------------------
Hi.
I have a jqGrid with load on scroll option on.
This is my code.
function something(){
$("#mailList").jqGrid({
datatype: getInboxMails,
colNames: ['', 'title', 'sender', 'date', 'Type', 'size', ''],
colModel: [
{ name: 'Custom', index: 'Custom', width: 40, align: 'left', sortable: false, formatter: inbox_customButton },
{ name: 'Title', index: 'Title', width: 200, align: 'left', formatter: inbox_customTitle },
{ name: 'Sender', index: 'Sender', width: 80, align: 'left', formatter: inbox_customSender },
{ name: 'Senddate', index: 'Senddate', width: 40, align: 'center' },
{ name: 'RcvType', index: 'RcvType', width: 20, align: 'center', sortable: false, formatter: inbox_customRcvType },
{ name: 'MailSize', index: 'MailSize', width: 60, align: 'left', sortable: false, formatter: inbox_customMailSize },
{ name: 'Docidx', hidden: true }
],
postData: { filter: '' },
pager: '#mailListPager',
rowNum: 4,
rowList: [5, 10, 20, 50],
sortname: 'Senddate',
sortorder: "desc",
caption: '',
scroll: true,
//scrollOffset: 0,
//autowidth: true,
//height: '100%',
//shrinkToFit: false,
scrollbar: true,
multiselect: true,
toppager: true,
cloneToTop: true,
viewrecords: true,
sortable: true,
jsonReader: {
id: 'Id',
root: function (obj) { return obj.rows },
repeatitems: false,
page: function (obj) { return obj.page },
total: function (obj) { return parseInt(obj.total) },
records: function (obj) { return parseInt(obj.records) }
}
});
//……………..other code
}
function getInboxMails(postdata) {
if (flag.gettingInboxMail) { return; }
flag.gettingInboxMail = true;
$.ajax({
url: '/Json/GetInboxMails',
type: 'post',
data: postdata,
dataType: 'json',
complete: function (jsondata, status) {
if (status == "success") {
flag.gettingInboxMail = false;
var json = $.parseJSON(jsondata.responseText);
if (json.Result != 0) {
alert(json.Message);
return;
}
$("#mailList")[0].addJSONData(json.Data);
if (json.Data.rows.length > 0) {
checkNewMails();
}
}
else {
flag.gettingInboxMail = false;
alert('Failed to get inbox mails.');
}
}
});
}
This is my code.
So my problem is that I am not getting a scroll bar to bind more data.
what i think is.. In the DB, there's 10 rows of data in total.
So I guess the jqGrid generates the div like
<div class="ui-jqgrid-bdiv" style="width: 1500px; height:390px;>
<div style="position: relative; height: 340px;>….</div>
these… and I am guessing that the second div's height is sized to how long it will be with all the rows binded…
and that div will make the scroll of the outer div
but as u can see the outer div is taller than the inner one. So it makes no vertical scroll..
I tried it with making my browser's height size small and the scroll appears.
I am going to need a scroll with small number of rows.
Is this a jqGrid bug or am I doing something wrong???
Please give me some advice.
Thank u
11:47
10/08/2009
Sorry Tom, but the code which you post is very very bad. You should never use datatype as function just to make $.ajax request internaly. There are a lot of jqGrid options which allows you to customize request how you as want. You can ajaxGridOptions option and serializeGridData and beforeProcessing callbacks which allows to modify the data which will be send to the server directly before sending and diractly after receiving the server response and befor the response will be processed by jqGrid. There are additionally many other possibility in form of jsonReader and jsonmap. You should do only the changes which are required and not change the general kind of processing in jqGrid.
Currenly you use only one from five parameters of addJSONData. The usage of other are required if you want to use scroll option of jqGrid.
First of all I would recommend you to rewrite your code using datatype: 'json'. I recommend you to add gridview: true option to all your grids additionally. After you will have working code you can consider to use scroll:1 or scroll:true option if it is really required for your application. I personally don't like the options.
Best regards
Oleg
12:29
26/04/2012
Thank u so much for the advice.
I am having a hard time cause I cant find any entire documents 🙁
Like here /jqgridwiki/doku.php?id=wiki:methods&s[]=addjsondata
I'm tryin to find what the 5 parameters are... but cant find any stuffs about that..
And about the ajaxGridOptions.. can't find the options I can use either...
Is there another page that I can get some full documentation?
Or any other ways for me to find the parameters for those you mentioned
Thank u!
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