Computer ForumsComputers  

Go Back   Computer Forums > Programmers Lounge > Programming Discussions

Reply
 
LinkBack Thread Tools Display Modes
Old 08-02-2007, 03:08 AM   #1 (permalink)
Newb Techie
 
Join Date: Aug 2007
Posts: 3
Default Javascript Object List: display and sort- How to?

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
Anna ms is offline   Reply With Quote
Old 08-04-2007, 02:42 AM   #2 (permalink)
Monster Techie
 
Join Date: May 2004
Location: Tucson, AZ, USA
Posts: 1,184
Send a message via AIM to Vormund Send a message via MSN to Vormund Send a message via Yahoo to Vormund
Default Re: Javascript Object List: display and sort- How to?

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).
__________________

Last edited by Vormund; 08-04-2007 at 02:46 AM. Reason: More info
Vormund is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 05:48 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0