nonethefewer: (Default)
[personal profile] nonethefewer
What I want today:

I have a table with companies in it.

I want an AJAXy sort of thing, that has a search box for each field I give a shit about.  I can enter, for example, "Shef" in the Name field and "Palm" in the City field, and get both Sheffield Company in Palm Springs, and also Sheffield Corporation in Palm Beach, listed.

I want then to be able to select one of the entries.  Though I can live with just searching enough until there's only one.  From the results, I need the company's ID, so that I can use it in a form on the page.

...and yet, I know cock-all about AJAX.

Halp?

(no subject)

Date: 2011-04-28 12:51 am (UTC)
kaigou: life would be easier if I had the source code. (3 source code)
From: [personal profile] kaigou
I use a jquery script called dataTables to do most of what you're talking about. Output the details as a table (with thead and tbody), and you can sort by each column, as well as search. (Search results bring everything that matches, so if "Shef" is in the name and in the city, you'd get all instances.)

Do the entire table inside a form, and add an additional radio button as the first column:

>td>>label>>input type="radio" name="select" value="'.$id.'">>/label>>/td>

and close out the table, add a submit button, and close out the form. Lets the person pick a single line that they want to edit. If you want to do multiples on one page (instead of reloading with new form using company ID), then use the form-submit.js script -- I think it's from DHTMLgoodies, actually. It's proven to be really reliable and sturdy; comes with a minimized ajax.js. Whatever you choose in the first form, upon submission, will reload a designated area with a new form or associated/searched info, or whatever.

Not sure if that helps, but that's the low-grade workaround I came up with.

(no subject)

Date: 2011-04-28 02:50 pm (UTC)
siderea: (Default)
From: [personal profile] siderea
What you describe sounds very like the tag auto completion ajax here and on LJ on the edit entry page. Maybe you could examine the code here for pointers.

February 2022

S M T W T F S
  12345
6789101112
13141516171819
20212223242526
2728     

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Jan. 24th, 2026 08:38 am
Powered by Dreamwidth Studios