Yes, almost exactly like your seond example... Each row is a record in a sense.
Primary Record:
Record 1: Col1 Col2 Col3
Record 2: Col1 Col2 Col3
Record 3: Col1 Col2 Col3
The data contained in Col1, Col2, & Col3 are each their own respective "drop down box" (single-select combo box). I've added the primary record (let's call it "merchant" to keep things organized). The "merchant" record in the database will be linked (one to many) to the other records in another table. For example, if I select "merchant" ID=1 (where merchantID=1), let's say I receive three records back from its linked table (as you've shown above). Each record has three pieces of data, columns 1-3 (let's call them C1, C2, and C3 to make it easier). In the merchant query C1 may equal 0 (nothing selected, or "default" selection of the combo box), or another integer. A separate cf_stored_procedure (query) is called which populates each and every dropdown (C1-C3) with the same categories & their own ID #'s so that if C1, C2, or C3 is greater than 0, it will match one of the category ID #'s. A higher numbered category box should not be "selectable" unless it's preceeding lower number box has something selected from it, i.e., you can't choose something from C2 unless something in C1 has been selected, and you can't choose something from C3 unless C2 has been selected.
>Is it Ok to submit without saving? Just refresh the page with the additional row? (perserving all data entered of course)
Absolutely. This is sort of the direction I was thinking it might need to go to be able to keep adding extra rows and "grow" the table before submitting the data.
>Would it work to check a box at the start of the row that says "delete" but not have the row change or hide? When submitted, the row would be deleted, until then it just shows a checkbox flagged for deletion?
Yes, right on the money. This is the functionality I was referring to originally. The row is simply checked with a checkbox as a flag to be deleted when the data is submitted for processing, but does not need to immediately be removed or hidden. In fact, it shouldn't be immediately removed or hidden in case the user changes their mind and decides not to delete that row. When the all of the data is submitted to be processed, the rows that were checked should simply be "overlooked" and left out of the processing. All of the other rows, however, need to be analyzed to update changes to any dropdown. The way the current stored procedure will operate is that it will "overwrite" the Primary Record with the entire contents of the grid, i.e., new rows + changes to existing rows, leaving out deletes.
Here's an example of a dataset (grid):
Primary Record (merchant ID=1):
merchant_id | Category1 | Category 2 | Category 3 | Delete? |
1 0 0 0
1 1 0 0
1 2 5 0
1 2 6 0
1 3 1 0 X
1 3 1 2
1 3 1 3 X
-> 1 3 1 5 (new row)
-> 1 3 2 1 (new row)
The new rows have been added "on the fly" and should be part of the entire dataset, while the two rows that have been checked for deletion (shown with X's) should be "skipped" when looping through the dataset to create the new record. Hope this helps!
Thanks again!
Main Topics
Browse All Topics





by: gdemariaPosted on 2006-08-10 at 06:31:49ID: 17287447
Is each row of the grid a record in the datatbase; and the columns are fields in that row?
Like this?
MyTable
Col1
Col2
Col2
Record 1: Col1 Col2 Col3
Record 2: Col1 Col2 Col3
Record 3: Col1 Col2 Col3
> I also need to be able to dynamically add multiple rows to the grid with combo boxes. In other words, if the user clicks "add row," I want to >increase the grid by another row without doing a submit and refresh to the grid, therefore, I'd like to be able to add more than a single row, then >process all of the rows at once when a "submit" is finally requested.
Is it Ok to submit without saving? Just refresh the page with the additional row? (perserving all data entered of course)
If it is, I will guide you on that using CF
If not, you should post this part in the Javascript area, it can be done through javascript by writing a new block containing the HTML for the row.
>I also need to be able to delete any checked rows (bind a checkbox in a column) to a piece of data, and not have the grid update/refresh each
>time a row is deleted; again, it needs to wait until final processing.
Would it work to check a box at the start of the row that says "delete" but not have the row change or hide? When submitted, the row would be deleted, until then it just shows a checkbox flagged for deletion?