Positioning of table rows

Permalink Browser Info Environment
With large tables one should be careful with naming the position numbers since currently it's only possible to edit or delete existing rows. Inserting a new row between existing ones can only be done by the position number of a new row. By default position numbers are automaticly assigned to rows like: 1,2,3,4,5,...

If, for instance, one wants to insert a new row between row 2 and row 3, one has to rename all rows from row 3 up to the last row.

So it might be a good idea to rename the rows like 10, 20, 30, 40, 50,... right from the start, to be able to easily insert rows later on.

A better solution would be an insert button for new rows, while the position numbers are automaticly assigned. Or, mayby even better, a positioning function by drag & drop.

Michael

Type: Discussion
Status: New
okapi
View Replies:
smartwebprojects replied on at Permalink Reply
smartwebprojects
Thank you for your ideas.

We've had the drag&drop sorting feature in our ToDo list for the future versions, but there are lots of plans and not always enough time to do them in time.

Your idea about starting the numbers initially with 10, 20, 30, etc. is very simple and great. It will be included in the next version.

If you want it immediately, you can do the following:

in 'packages/swp_tables/single_pages/dashboard/swp_tables/includes/rows_list.php':

1. REPLACE

foreach($rows as $row) {


WITH

$position = 0;
foreach($rows as $row) {
    $position += 10;


2. FIND

$row["orderBy"]


AND CHANGE TO

$position
okapi replied on at Permalink Reply
okapi
Thank you for your quick reply and for providing these snippets!

There's just one small problem:
i think the form for adding a new row should also be updated, because if, for instance, one has rows 10 to 80, and wants to insert a new row between row 70 and row 80, with the new name "71", this is now automaticly changed to "90" and positioned right after row 80. Even renaming of rows is now impossible, because the number is always automaticly updated to the number of the last row + 10).

---

Another thought concerning numbers to sort table rows:
Having working numbers in the form 10,20,30,... is nice, but it will limit the number of potentially new rows to 9 rows between each pair of numbers. What, if one has 12 rows to insert between two existing rows?

I think a drag&drop or a move-up/down solution via buttons, with a function for automatic definition of the resulting position numbers in the background, would be the best.

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.