Javascript Object List: display and sort- How to?

Status
Not open for further replies.

Anna ms

Beta member
Messages
3
Hello, i am a javascript newbie, as well as in php/mysql

and i need some help on some web app admin interface i have the task to developp:

i have a long list of object: books with properties like title, author, publication date, subject, similar books list with their title and date of publication.

how do i generate the list books object after getting that list of books after retrieving it through php from a mysql database and then display that list of books in an HTML table?

Then i would like to be able for the user of that admin system to be able to sort the list by title, author, date or even subject?

why all of this should be done in JS instead of php, it's because i have been ordered to do dev this in JS by my boss (i ma an intern)

i would like to have the layout of the functions i have to write to do this three things!
1-generate javascript objects Books (list?) out of php/mysql!
2-display the list of book in html table (one cell with title, author, publication and subject) and the second cell (lits of similar books with title and date of publication)
3-sorting books by title, author, date or subject

Thanks in advance
 
Using something like this to help with the sorting would make things easy... or it sounds like it, anyway.

You can generate the XML file with PHP (pull data from the database and spit out a nice format for the javascript to read).

I'm not sure how that above script works, as I just Google'd it, but I'd guess that you could then write a somewhat simple javascript function to generate the table based on your XML input from PHP. (Then that above script would do the sorting for you...hopefully). I'd look at it but I really don't want to register on that site, tonight... :)

Any specific questions, do ask.

--
This is a good reference, too.

After reading a bit, depending on your database size, (and a comment on that link, near the top, agrees), AJAX may be a wise choice. Paging the data while allowing the sort with the present data.

This could be done fairly easy, using parameters when retrieving your PHP-generated XML file. (You'd specify the start...id, time, or whatever it's being sorted by when called from the db, and have a link increment/decrement as necessary on the page).
 
Status
Not open for further replies.
Back
Top Bottom