Ajax: Livegrid

I thought you might like this, try it out and let me know what you think:

With Rico and prototype, you are able to connect an HTML table to a database table. The database currently has around 42831 records of zipcodes and such. Since the table only pulls in the data as-needed we could have had tens of thousands of zipcodes and still experienced similar performance.

To view the demo: http://lab.mrayyan.com/rico-livegrid/
To download the demo: http://lab.mrayyan.com/rico-livegrid/live_grid_class.zip

For the livegrid, make sure you fix the link to prototype on the grid class.
That is all

Sphere: Related Content

Uncategorized

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

A couple of things:
on my browser (xp, ie 6.0) the grid has black cells in it. don’t know if that is by design or a bug. also, i kinda like the grid that daren’s put together. it’s kinda simple. but i still have a problem with not updating the text in the cell. it updates the database but the javascript doesn’t update the cell. i’ve narrowed it down to this line of code in the parseForm function:

x_changeText(st, textChanger_cb);

this code which sajax has turned to javascript (the php version is called changeText and is defined earlier in the code) calls textChanger_cb which is also a javascript function. this function takes an argument by the name of ‘result’; however when x_changeText. what I don’t understand is how the argument is being passed to textChanger_cb.

textChanger_cb is a pretty simple function: it splits the arragy it receives by the infamous ‘~~|~~’ and then assigns it to the the document element that it also received in the argument list by doing the innerHTML.

the code runs perfectly standalone meaning when it’s not integrated into my application; however, when i run it within the confines of my application, it gets stuck on the updating… part. right nowk, just trying to figure why result is empty when i run it within my application.

thanks for your code and sorry for the long piece in here.

You are saying it works perfectly find standalone… then try this: remove link to other .js files you have in your page and then start narrowing down other functions you have on your site till the liveedit works.

Sometimes things can conflict with each other for a simple reason such as ID handling or even function calling.

If that doesnt help, I can take a look at your code and see if I can help you out

wouldn’t the browser throw a fit if i had problems with conflicting id’s or anything that may be going wrong with javascript. js is really picky about things like that.

actually, i found where the problem is. it’s basically in the sajax code where he is trying to get the text of the object and loads a variable called data with it. well, in my case, it didn’t work the way he had anticipated it because i had to embed this within an existing php framework.

to make the story short, once i started substringing for what he was looking for and only loading the substring into the variables, everything started to work even within my php framework. now i can put this puppy to a whole lot of uses. but i like to thank you for your help! shawn

@ shawn (or morad if you know the answer):

I have exactly the same problem : I have an existing website in which I include the livegrid code (using PHP). Just like shawn said, it does work in “standalone” mode, but not when it is included. I too found the part of the SAJAX code that (normally) fetches a variable, but in my case it takes the whole code of the page, which can’t obviously be interpreted later on.

My problem is that I don’t know what to substring like shawn did, so I could use a hint !

Yes ! I figured it out by myself ! Here’s how I did it, in case someone’s wondering like I was :

Somewhere along the SAJAX code, there’s this line of code :
var txt = x.responseText.replace(/^\s*|\s*$/g,”");

And earlier in the code, there’s this one :
echo “var res = ” . trim(sajax_get_js_repr($result)) . “; res;”;

All you got to do is add a new line after the “echo” which adds another ” :” (or some other weird character combination), and then add a line after the “var txt =” line like this one :

txt = txt.substring(txt.indexOf(” :”),txt.lastIndexOf(” :”));

That’s how you “substring” the interesting part of the code out of the whole thing.

levitra…

news…

Leave a comment

(required)

(required)