best ui toolkit?

I'm trying using the pure jquery jqgrid. I've write the javascript code to display a datagrid, I get the code from jqgrid demos jqGrid Demos. Now I have great problem to take data from a rails model. I don't know how and there isn't examples.

Msan Msan wrote in post #974414:

have you some examples?

Msan Msan wrote in post #974539:

Msan Msan wrote in post #974539:

Have Rails put the data in the DOM. Have the JS read it. Done.

have you some examples?

What part don't you understand? You already know how to have Rails put the data in the DOM. Presumably you already know how to have the JS read it?

Or is something else confusing you?

It's not clear to me how put data in the DOM and how to read. Sorry for my ignorance.

Msan Msan wrote in post #974652:

read it?

Or is something else confusing you?

It's not clear to me how put data in the DOM

You've probably put data in the DOM thousands of times using Rails. The DOM is simply the document represented by the HTML that Rails generates. You already know how to put data in the HTML generated by Rails, right?

and how to read.

With any of the myriad JS functions for that purpose (such as Element.innerHTML...)

Sorry for my ignorance.

No apology is necessary for ignorance. Apology is only necessary if you're not using the knowledge you *do* have. :slight_smile:

Best,

Whenever you have Rails create HTML content and serve it to the browser (i.e., pretty much all the time) you are putting that content into the DOM (Document Object Model) of the browser. Now if you place some content above the visible page using CSS, or simply set it to display:none, it will still be in the DOM, but it will be hiding and waiting for you to do something with it subsequently using JavaScript.

In Prototype, you most easily access a single HTML element (like a DIV) using the $('theIdOfTheElement') shortcut for the native JS getElementById(id) construct.

If you want to access a collection of elements that have the same tag name or classname or some other common denominator, you use $$('div.foo') or similar. That gets you an enumerable collection, which you iterate using each(), just like in Ruby.

If you want to grab the content of a DIV, or show it from its hidden state, or make it bound around the window like a terrified mountain goat, you can do that once it's in the DOM.

You can also access content from your server using an Ajax call, and either directly replace any element in the page, or use that content as variable data to further modify your page.

I believe that jQuery is similar to Prototype in syntax and construction. You may find an easier path to answers by looking up the library documentation on their very glossy site.

Walter

that's a lot of work, only for using jqgrid.