MySQL Interaction with DataTable & Editor Using PHP and Javascript

MySQL Interaction with DataTable & Editor Using PHP and Javascript

rmattesichrmattesich Posts: 2Questions: 0Answers: 0
edited February 2013 in Editor
Hello fellow insomniacs. Need help to optimize interaction between MySQL and Java powered browsers.
I am using Data Tables and related Editor as front ends for a fairly large MYSQL database. Allan did a great job in integrating these tools but I am having trouble breaking into his modules to cutomize this interaction using PHP at the server, or Java at the browser.
One example:
The data base stores three fields as: (1) Last Name, (2) First Name, (3) Middle Name.
Challenge: The Table should display this data in same order, eg., (1) Public, (2)John, (3) Q."
The Editor, however, should allow the data to be entered as "First Name Middle Name Last Name, eg, John Q. Public.
Question: Where is this conversion best accomplished? On the server side or at the browser side? PHP or Java? Any relevant code snippet that I can use?

Many thanks to anyone who can help me sleep a few more hours.
rom

Replies

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    In terms of the Editor view, I think you have two basic options:

    1. Display three individual fields: first, middle and last names. That is probably the easiest option.
    2. Create a field type plug-in that has three input boxes, one for each name.

    You could possibly use a single text box and then do a 'split' on space characters, but you'd run into problems with multiple middle names and possibly multiple surnames. How to know which ones are the middle names?

    If to do that the single field approach, it doesn't really matter where the split is done, client-side or server-side (and it certainly doesn't matter if it is php or java) as long as the system is consistent (i.e. the server-side knows what the client-side is sending). I don't think there is really a benefit of doing it one way over another.

    The other way, with field type plug-ins, for that you might be interested in looking through this tutorial on how to create field type plug-ins: http://editor.datatables.net/tutorials/field_types

    Regards,
    Allan
This discussion has been closed.