Forum


19:20

29/11/2008

I have just started using jqgrid on a different project and am loving it.
But I am wondering if I am doing it the hard way with this project.
(I've redesigned the database twice already, but I have a hunch it's still wrong, and that may be my real problem.)
The user is supposed to be able to fill out a timesheet, something like the one pictured below, with dates along the top and project numbers along the side:
The 3 columns within each date column are for recording regular time worked or two kinds of overtime. When a new week starts they will see a blank grid and begin entering the project on which they are working, and what kind of hours on what days they worked. Throughout the week they will return to it and add or edit their work hours.
The database has fields: id, lineid, projectid, workdate, regulartime, overtime, bankedtime, employeeid (plus some others).
As you can see, a unique line of data in my database doesn't coincide with a line of data on the form. For example, the 3 green cells would be from one db entry, which holds the date, project id and times worked.
I can imagine writing the looping php/mysql code to extract the data manually into the xml necessary for jqgrid to build this form very nicely, but it seems like my php code is doing all the work, and when it comes to editing a cell or a line, I'll be writing all the code and loops and not really using the power and elegance of jqgrid.
Am I missing something obvious?
Am I barking up the wrong tree?
Is there an elegant way to do this?
(By the way, my bosses don't seem to think that the layout of the input form should be changed.)
Thanks for any help, criticism, suggestions or ideas you all have!
12:01

29/11/2008

Thanks. The grid/subgrid or master/detail option is very intriguing, and one that I hadn't explored at all. In this case, the reason the user enters a project number as text (rather than selecting from a list) is because there are hundreds of projects in the database, and we're trying to keep the form as simple and compact as possible (plus they'd like it to look somewhat like the old MS Jet database one we're replacing). So when they enter a project number, it's is looked up in the database and an english name is shown to the user, and then the rest of the line knows which project ID to assign the work times to when writing to the database. It seems convoluted to me, but I'm struggling with finding the simpler solution that must be out there. So far I can see the subgrid as simplifying this, but I'll keep pondering throughout the day.
Thanks again. Your suggestions get me thinking in different directions, which is exactly what I need!
13:58

13/11/2008

OK. I see your dilema then.
Let's get creative then. A simple input filed before diplaying the grid. User starts typing in project number. Jquery autocomplete fetches possible matches from database. Onblur of the input feild and gird is created with the data pertaining to the specific project. This would maybe allow you to instead of relying on the users to update the time spent, just add aditional time and let server sum it all up.
Just an idea 😉
Cheers,
P.
Most Users Ever Online: 715
Currently Online:
61 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66