- Posts: 3
COMMUNITY FORUM
Extra field values - ordering
- Ania
-
Topic Author
- Offline
- New Member
I have several extra fields where I need to put number values. I create i.e. an extra field (drop-down list or multi select list) called "lenght" . I put put 100, 200, etc. but then when I need to add i.e. 30 it goes to the end of the values list. It means the values aren't ordered and I need them to be ordered.Otherwise, when I leave it at the end, the K2 Extra fields Filter & Search doesn't work properly.
I can't use text fileds. They must be a list.
Is there any way the values are ordered automatically ?
Please Log in or Create an account to join the conversation.
- Aaron
-
- Offline
- Premium Member
You will not be able to change the ID of the extra field through ordering. Those are written in the database and are unique IDs for the field.
Aaron :)
Please Log in or Create an account to join the conversation.
- Ania
-
Topic Author
- Offline
- New Member
- Posts: 3
Please Log in or Create an account to join the conversation.
- Andrey Miasoedov
-
- Offline
- Senior Member
The default values ordering should not be affected in ordering by extrafields or what problems you are experiencing?
Please Log in or Create an account to join the conversation.
- Janette Tilley
-
- Offline
- New Member
- Posts: 2
Essentially, it seems, you need to know all the possible values of your content first to create the default list. This doesn't allow the possibility of growth or change over time which seems counterproductive.
This is especially important if using the extra fields search and filter extension: the frontend user will see a drop-down list that is not in any logical order.
Is this just a limit of the K2 extra fields??
Please Log in or Create an account to join the conversation.
- Altjon Kodra
-
- Offline
- New Member
- Posts: 1
I have a list with 300 names alphabeticlly ordered and if I want to add a new name that starts with A... think about it!!!
The only option is to DELETE all 300 names and write everything from scratch, NO GOOD!
Please somebody help with this, it should be possible to re-order values in the extrafields.
Thanks
Please Log in or Create an account to join the conversation.
- Andrew
-
- Offline
- New Member
- Posts: 1
Like a Drupal taxomony list of terms.
An automatic alphabetical/numerical resort would be an improvement, so you don't have to delete every item to get back to the A's.
Easy enough to re-sort in phpmyadmin but don't think too many clients would be happy with that!
A
Please Log in or Create an account to join the conversation.
- Kelsey Brookes
-
- Offline
- Elite Member
I've got a very long list of extra field options in a multi-select with no discernable order due to the nature of the field's growth.
Deleting and re-adding is not an option.
Please Log in or Create an account to join the conversation.
- Jonas Reggelin
-
- Offline
- New Member
- Posts: 1
Please Log in or Create an account to join the conversation.
- Marco van der Ziel
-
- Offline
- New Member
- Posts: 2
Please Log in or Create an account to join the conversation.
- Uldis
-
- Offline
- Senior Member
- Posts: 69
Please Log in or Create an account to join the conversation.
- Micha
-
- Offline
- New Member
- Posts: 14
Never find one that really worked.
I started searching for a better way to fix the order of extra fields and found this.
Go to your phpmyadmin or whatever you use for your database. (See image)
1. Click on '????_k2_extra_fields' in the left column.
2. Click one time on the extra field number you want to change in the 'ID' column and start sorting it that way.
Worked out fine for me!
Please Log in or Create an account to join the conversation.
- Mohamed Abdelaziz
-
- Offline
- Platinum Member
- Joomla Developer
Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
Please Log in or Create an account to join the conversation.
- Bernd Duhnke
-
- Offline
- New Member
- Posts: 1
Please Log in or Create an account to join the conversation.
- K Coyne
-
- Offline
- New Member
- Posts: 5
Please Log in or Create an account to join the conversation.
- Jim Van Zile
-
- Offline
- New Member
- Posts: 6
Please Log in or Create an account to join the conversation.
- Catherine Mollet
-
- Offline
- New Member
- Posts: 8
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Ronny Van Der Borght
-
- Offline
- Senior Member
Convert your extra field to a list with:
<?php $extrafieldtolist = explode(',',$this->item->extraFields->MyExtraField->value); ?>
<ul id="sortable-list">
<?php foreach ($extrafieldtolist as $extrafieldtolist): ?>
<li class="<?php echo $extrafieldtolist; ?>"><?php echo $extrafieldtolist; ?></li>
<?php endforeach; ?>
</ul>
and then do some jQuery magic:
<script>
(function( $ ) {
$(function() {
$( "li", "#sortable-list" ).sort(function( a, b ) {
return $( a ).text() > $( b ).text();
}).appendTo( "#sortable-list" );
});
})( jQuery );
</script>
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
Since you are a dev, why not include your website or some contact info in your signature ;)
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.