|
Assuming your data is something that ends up as a data-structure on the
client-side (JSON preferably), just loop through building your nodes as
you go. A table doesn't seem necessary since you really only have one
column.. Response example (server data encoded to JSON): [{desc:'Job Description 1',id:'1'},{desc:'Job Description 2',id:'2'}] I would probably use Ajax.Request to create a popup or something, or Ajax.Updater with an overridden insertion function like so: CSS: ul.joblist li { cursor: pointer; } ul.joblist li:hover { background-color: #ffffee; } _javascript_ new Ajax.Updater('pickone','page',{ insertion: function(element,update){ //server responds with json object in response body var json = update.evalJSON(); var list = Builder.node('ul',{className:'joblist'}); element.appendChild(list); json.each(function(job){ var li = Builder.node('li',{id:'jobid-'+job.id},[job.desc]); Event.observe(li,'click',populate); list.appendChild(li); }); } } function populate(event){ var element = Event.element(event); id = element.id.split('-')[1]; new Ajax.Updater('jobdesc','page',{parameters: {id: id}}); //destroy the list? remove element.parentChild and be sure to cleanup event observers } I also have a very lightweight tooltip class that includes the ability to create a popup and populate it easily with elements that have event handlers that will be cleaned up when the popup is closed if you are concerned about proper cleanup. This looks strangely familiar to Autocompleter! Maybe that would be something to look at... Colin EWonka wrote: Thanks Ryan, It's a fairly simple requirement actually, an ajax request will be sent to the application server and it will return data. The data will be comprised of a job description and id. I would like to take the data and form a display that for each row will contain a 'select button', description, id.The user will simply press the button (labeled "Select") for the specific row and the job description will be populated on the orginal form in a textbox. I am trying to avoid the classic drop down and go with "something" similar to a table type display. Your patience is appreciated. thank you. On Mar 30, 10:16 am, "Ryan Gahl" <[EMAIL PROTECTED]> wrote:While your requirements at this point are pretty vague... I'll just say yes, and that you should look, possibly, at scriptaculous's AutoCompleter control. On 3/30/07, EWonka <[EMAIL PROTECTED]> wrote: --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~--- |
- [Rails-spinoffs] Re: Basic guidance Colin Mollenhour
- [Rails-spinoffs] Re: Basic guidance RobG
- [Rails-spinoffs] Re: Basic guidance David Dashifen Kees
