Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I just noticed that in my implementation, a CCK Date field can not be made sortable in a Views table. See attached.
Is this a cck date field rule, or is there a configuration which will allow cck date fields to be sortable in a Views table? Below is an export of the view in question. Thanks for any assistance.
php version: PHP 5.1.6
php4.module enabled?: Yes
Export of content type and cck date fields: attached
$view = new view;
$view->name = 'EventsTest';
$view->description = 'Test View for Events';
$view->tag = 'events';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
'title' => array(
'label' => 'Title',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'link_to_node' => 1,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'relationship' => 'none',
),
'field_eventstart_value' => array(
'label' => 'Start date',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'link_to_node' => 0,
'label_type' => 'widget',
'format' => 'short',
'multiple' => array(
'multiple_number' => '',
'multiple_from' => '',
'multiple_to' => '',
'group' => 1,
),
'repeat' => array(
'show_repeat_rule' => 'show',
),
'fromto' => array(
'fromto' => 'value',
),
'exclude' => 0,
'id' => 'field_eventstart_value',
'table' => 'node_data_field_eventstart',
'field' => 'field_eventstart_value',
'relationship' => 'none',
),
'field_teststart_value' => array(
'label' => 'Test date',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'link_to_node' => 0,
'label_type' => 'widget',
'format' => 'default',
'multiple' => array(
'multiple_number' => '',
'multiple_from' => '',
'multiple_to' => '',
'group' => 1,
),
'repeat' => array(
'show_repeat_rule' => 'hide',
),
'fromto' => array(
'fromto' => 'both',
),
'exclude' => 0,
'id' => 'field_teststart_value',
'table' => 'node_data_field_teststart',
'field' => 'field_teststart_value',
'relationship' => 'none',
),
));
$handler->override_option('sorts', array(
'created' => array(
'id' => 'created',
'table' => 'node',
'field' => 'created',
'order' => 'DESC',
'granularity' => 'second',
),
));
$handler->override_option('filters', array(
'type' => array(
'id' => 'type',
'table' => 'node',
'field' => 'type',
'operator' => 'in',
'value' => array(
'0' => 'event',
),
),
'status' => array(
'id' => 'status',
'table' => 'node',
'field' => 'status',
'value' => '1',
),
'date_filter' => array(
'operator' => '<',
'value' => array(
'value' => NULL,
'min' => NULL,
'max' => NULL,
'default_date' => 'now',
'default_to_date' => '',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'date_fields' => array(
'node_data_field_eventstart.field_eventstart_value' => 'node_data_field_eventstart.field_eventstart_value',
),
'date_method' => 'OR',
'granularity' => 'day',
'form_type' => 'date_select',
'default_date' => 'now',
'default_to_date' => '',
'year_range' => '-3:+3',
'id' => 'date_filter',
'table' => 'node',
'field' => 'date_filter',
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'none',
'role' => array(),
'perm' => '',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler->override_option('title', 'Test Events');
$handler->override_option('header_format', '1');
$handler->override_option('footer_format', '1');
$handler->override_option('empty_format', '1');
$handler->override_option('items_per_page', '30');
$handler->override_option('use_pager', '1');
$handler->override_option('distinct', 0);
$handler->override_option('style_plugin', 'table');
$handler->override_option('style_options', array(
'grouping' => '',
'override' => 0,
'sticky' => 0,
'order' => 'asc',
'columns' => array(
'title' => 'title',
'field_eventstart_value' => 'field_eventstart_value',
'field_teststart_value' => 'field_teststart_value',
),
'info' => array(
'title' => array(
'sortable' => 1,
'separator' => '',
),
'field_eventstart_value' => array(
'separator' => '',
),
'field_teststart_value' => array(
'separator' => '',
),
),
'default' => '-1',
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'view/test/events');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
));
Comment | File | Size | Author |
---|---|---|---|
groupeventcontenttypeexport.txt | 6.79 KB | SomebodySysop | |
tableeventfieldsortable02.jpg | 14.87 KB | SomebodySysop |
Comments
Comment #1
Firetracker CreditAttribution: Firetracker commentedHi,
Any news on this? It would be a very useful feature
Cheers
Zap
Comment #2
asyd CreditAttribution: asyd commentedI'm agree, I also need this feature!
Comment #3
arlinsandbulte CreditAttribution: arlinsandbulte commentedHi,
I am just indiscriminately closing all support requests with no activity for more than 1 year.
If you consider this to still be a valid issue / support request, feel free to re-open.
BUT,
if you are re-opening this issue, please provide specific details on how this issue can move forward.
Thanks.
Comment #4
spgd01 CreditAttribution: spgd01 commentedI still see this in D7 I cannot click sort by date in a table in views. Any Ideas on how to fix this?
Comment #5
milos.kroulik CreditAttribution: milos.kroulik commentedClosing this as there aren't any new reports. The reason seems to be using unlimited values in Date field, which Views integration cannot handle. After limiting it to only one value, everything seems to be working as designed.