Buy Now
Sign in

get a value from funtion based row id in table-view

seppo , August 01 2017
Answered
S
seppo
I have a table in view tab (lists->table). In one of the columns of that table I have a dropdown, having same list as the table itself (to select a parent category in list of categories). I get the list there fine, but the problem is marking current correct one as selected.

It seems in columns list in table-view, _edit works only for textfield, not for dropdown. So I created a field-view to place there a dropdown, calling it in the table-view's Columns view. But how to get the table-view to pass it's current row's value? i.e. in the table-view it could be marked for one column as Model-Name.id-field. I tested to use that same format model-name.field in the dropdown's selected input area, but it didn't work, likely because it is no longer using that Model. I could call there a read date function, but how to get the function to get the current row's id so it could use it as where-input.
admin
Hi seppo,

The table list view passes this variable to each row:
{var:table_view_name.row}

This has the data for all the fields of that row, you can test it using
{var.pr:table_view_name.row}
to check which data is included and call the correct one in the selected values of the dropdown.

Best regards,
Max
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
S
seppo
Thank you Max for the info!

One further question, partly regarding same situation. I got now the selected-value to work there, but faced another problem:
I have that dropdown in the tableview, with a purpose that user can edit some values there, and press the update button to submit the changes. It works fine for text field in the same row, it's changes gets updated normally. However the changes with dropdown are not updated / saved.

The difference is:
editing text field is done by adding _edit to field name in columns list at table view.
Dropdown is in it's own field-view, loaded through list of Column within table-view.

So it seems the dropdown is not included in submitted form fields, while the text field is. How to includ the dropdown for submitted items too?
admin
Hi Seppo,

editing text field is done by adding _edit to field name in columns list at table view.

How exactly ?

The correct way is to call any field using a fields view inside the column you need.

Best regards,
Max
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
S
seppo
In table-view, columns list I have:

Category.category:Category
Category.parentcat:Parent category
category_edit:Edit category

Then in Columns views in the same table-view:
Category.category:{view:category_view_link}
Category.parentcat:{view:parentcategories_dropdown}

Where the parentcategories-view is a dropdown field.

In the frontend I see this as in attached image. The text field, marked with that _edit (like in the Dynamic Actions demo) updates OK, but the dropdown does not for some reason
Attachments
cctemp.jpg
cctemp.jpg
(83.43 KiB)
175 Downloads/Views
admin
Hi seppo,

Yes, there are a special loop and save functions for saving the title, you will need to have the same for the dropdown OR modify the fields names and modify the loop and save function settings a little bit.

Best regards,
Max
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!