Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
This topic is locked No permission to create posts
sp_Feed Topic RSS sp_TopicIcon
jqGrid 3.6 beta
05/11/2009
15:39
Avatar
markw65
Member
Members
Forum Posts: 179
Member Since:
30/07/2009
sp_UserOfflineSmall Offline

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

05/11/2009
16:08
Avatar
markw65
Member
Members
Forum Posts: 179
Member Since:
30/07/2009
sp_UserOfflineSmall Offline

Tony,

Not a critical bug, but I noticed your last git update didnt include my commit: d8effc6f310560ddd1d5ba4cbf73f5b9b00a774a

It probably wont affect anyone but me, and I have the fix :-), but just FYI

Mark

06/11/2009
00:48
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

06/11/2009
08:52
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

06/11/2009
09:22
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

06/11/2009
10:49
Avatar
markw65
Member
Members
Forum Posts: 179
Member Since:
30/07/2009
sp_UserOfflineSmall Offline

Hi Tony,

Great that github is working for you again!

I noticed one odd change: 5a4510e47e65d21a0681a20d72111753c2ae8459

             jQuery(celm).addClass("customelement").attr({id:options.id,name:options.name});
-            jQuery.(elem).append(celm);
+            jQuery(elem).html(celm);
The first line creates an element from the celm html, adds a class and some attributes - but does nothing with it (effectively throwing it away).
Then the new line simply inserts the html into the element...
I think what you really meant is something like:

celm = jQuery(celm).addClass("customelement").attr({id:options.id,name:options.name});
jQuery(elem).empty().append(celm);
Mark
06/11/2009
12:12
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

This topic is locked No permission to create posts
Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
33 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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information