Forum
15:39
30/07/2009
jhsu said:
As for the retrieving data part, the behaviour of hitting the server several times before the mouse is released from the scroll bar seems to be consistent across all the browsers I tested, IE6, IE7, firefox, Safari and Chrome.
So the problem here is that you dont know when the user releases the mouse (or at least, I dont - perhaps there's a way!).
What happens, is that you get a series of "grid scrolled" events. To try to prevent hitting the server too many times, Ive set it up so that when a grid scrolled event occurs it kicks off a timer. If no new scroll event occurs within the next 200ms, it fetches the data, if a new one does occur, it resets the timer.
Perhaps 200ms is too short - but much longer than that and it will seem unresponsive.
Mark
00:48
Moderators
30/10/2007
Mark,
I have a chance to push only once and nothing more. My saga with the Git continue. I can not push anymore.
I have do a lot of other fixes, but...
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:52
Moderators
30/10/2007
Mark,
Now all is OK with the Git (moving the repo to Ubuntu).
Have merge the your last commit.
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.
09:22
Moderators
30/10/2007
Hello Roman,
Thank you for this post.
Let me discuss a little bit.
1. The article that you post say that JSON is secure and eval is not safe.
It is not really true. I think that there is not complete secured thing. This is true for JSON too. I recommend you to read this http://directwebremoting.org/b.....it_is.html
in order to understand what is happen. Another good link is here
http://solutoire.com/2007/03/1.....your-json/
2. Appling JSON parse direct to jqGrid will cause the most user not use jqGrid. The reason is how the user configure your response from the server. Let make a example:
var a = '{"a":1}';
var b = "{'b':1}";
JSON.parse(a); //--> Result OK
JSON.parse(b); //--> Fail
eval('('+a+')'); //-- Result OK
eval('('+b+')'); //-- Result OK
I think you see the difference. When we use standart json encoder like in PHP json_encode and (there is such one in ASP) all is ok, but in case that this is not possible the most developers write thier response like in variable b. If you read the most messages in this forum connected to json response, you will see that about 50% of the responses that users post here is like the variable b.
But when goes to speed improvements I'm open and redy to apply them if they will not brake the existing code.
For my pleasure I have made some tests only in FireFox 3.5 comparing the times of parsing and I'm surprised how JSON.parse if fast.
The tests vary, but parsing 4 columns with 300 records - take 1ms with JSON.parse and 10ms with eval - wow 10 time faster.
In order that all will be happy I introduce another option in $.jgrid object called useJSON (default false) and have made the needed changes to the parse function (also published in the GitHub)
parse : function(jsonString) {
var js = jsonString, msg;
if (js.substr(0,9) == "while(1);") { js = js.substr(9); }
if (js.substr(0,2) == "/*") { js = js.substr(2,js.length-4); }
if(!js) { js = "{}"; }
($.jgrid.useJSON===true && typeof (JSON) === 'object' && typeof (JSON.parse) === 'function')
? msg = JSON.parse(js)
: msg = eval('(' + js + ')');
return msg.hasOwnProperty('d') ? msg.d : msg;
},
..
3. About the second I think this is great and as you can see it is already in the code.
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.
10:49
30/07/2009
Hi Tony,
Great that github is working for you again!
I noticed one odd change: 5a4510e47e65d21a0681a20d72111753c2ae8459
12:12
Moderators
30/10/2007
Mark,
As usual ... Thanks Fixed.
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.
Most Users Ever Online: 715
Currently Online:
26 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