All my ajax paging blocks row styles broke when upgrading to views 3.
The blog style looks fine on page 1 (say row style = table). When paging via ajax to page 2 the row style returns to (unformatted, or better the style is lost)
Also blocks with Grouping Fields lose there grouping field display when paging.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

vlooivlerke’s picture

Ok, I have figured one thing out.
If I change my default view row style to table, then my second page will use the row style table, even if the block display style is set to grid. So page one will show grid and page 2 and more will use table (default view)

merlinofchaos’s picture

Can you attach an export of an example view that's exhibiting this behavior?

vlooivlerke’s picture

I will have to build a simple view from scratch. Will report soon. My production views will not work as I have allot of cck in them.

Majdi’s picture

I'm facing same problem check #1188960: Table style lose Style settings on ajax pager it has more explanation

It's lose the display not the style first page load file , but if you click on pager to see next page , its load the default display

Majdi’s picture

$view = new view;
$view->name = 'frontpage';
$view->description = 'Emulates the default Drupal front page; you may set the default home page path to this view to make it your front page.';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Front page';
$view->core = 0;
$view->api_version = '3.0-alpha1';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Defaults */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'node';
$handler->display->display_options['row_options']['links'] = 1;
/* Field: Node: Comment status */
$handler->display->display_options['fields']['comment']['id'] = 'comment';
$handler->display->display_options['fields']['comment']['table'] = 'node';
$handler->display->display_options['fields']['comment']['field'] = 'comment';
/* Field: Node: Delete link */
$handler->display->display_options['fields']['delete_node']['id'] = 'delete_node';
$handler->display->display_options['fields']['delete_node']['table'] = 'node';
$handler->display->display_options['fields']['delete_node']['field'] = 'delete_node';
/* Field: Node: Edit link */
$handler->display->display_options['fields']['edit_node']['id'] = 'edit_node';
$handler->display->display_options['fields']['edit_node']['table'] = 'node';
$handler->display->display_options['fields']['edit_node']['field'] = 'edit_node';
/* Field: Node: Has new content */
$handler->display->display_options['fields']['timestamp']['id'] = 'timestamp';
$handler->display->display_options['fields']['timestamp']['table'] = 'history_user';
$handler->display->display_options['fields']['timestamp']['field'] = 'timestamp';
/* Field: Node: In moderation */
$handler->display->display_options['fields']['moderate']['id'] = 'moderate';
$handler->display->display_options['fields']['moderate']['table'] = 'node';
$handler->display->display_options['fields']['moderate']['field'] = 'moderate';
/* Field: Node: Last comment time */
$handler->display->display_options['fields']['last_comment_timestamp']['id'] = 'last_comment_timestamp';
$handler->display->display_options['fields']['last_comment_timestamp']['table'] = 'node_comment_statistics';
$handler->display->display_options['fields']['last_comment_timestamp']['field'] = 'last_comment_timestamp';
/* Field: Node: Link */
$handler->display->display_options['fields']['view_node']['id'] = 'view_node';
$handler->display->display_options['fields']['view_node']['table'] = 'node';
$handler->display->display_options['fields']['view_node']['field'] = 'view_node';
/* Field: Node: Path */
$handler->display->display_options['fields']['path']['id'] = 'path';
$handler->display->display_options['fields']['path']['table'] = 'node';
$handler->display->display_options['fields']['path']['field'] = 'path';
/* Field: Node: Post date */
$handler->display->display_options['fields']['created']['id'] = 'created';
$handler->display->display_options['fields']['created']['table'] = 'node';
$handler->display->display_options['fields']['created']['field'] = 'created';
/* Field: Node: Promoted to front page */
$handler->display->display_options['fields']['promote']['id'] = 'promote';
$handler->display->display_options['fields']['promote']['table'] = 'node';
$handler->display->display_options['fields']['promote']['field'] = 'promote';
/* Field: Node: Published */
$handler->display->display_options['fields']['status']['id'] = 'status';
$handler->display->display_options['fields']['status']['table'] = 'node';
$handler->display->display_options['fields']['status']['field'] = 'status';
/* Field: Node: Type */
$handler->display->display_options['fields']['type']['id'] = 'type';
$handler->display->display_options['fields']['type']['table'] = 'node';
$handler->display->display_options['fields']['type']['field'] = 'type';
/* Sort criterion: Node: Sticky */
$handler->display->display_options['sorts']['sticky']['id'] = 'sticky';
$handler->display->display_options['sorts']['sticky']['table'] = 'node';
$handler->display->display_options['sorts']['sticky']['field'] = 'sticky';
$handler->display->display_options['sorts']['sticky']['order'] = 'DESC';
/* Sort criterion: Node: Post date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Filter: Node: Promoted to front page */
$handler->display->display_options['filters']['promote']['id'] = 'promote';
$handler->display->display_options['filters']['promote']['table'] = 'node';
$handler->display->display_options['filters']['promote']['field'] = 'promote';
$handler->display->display_options['filters']['promote']['value'] = '1';
$handler->display->display_options['filters']['promote']['group'] = 0;
$handler->display->display_options['filters']['promote']['expose']['operator'] = FALSE;
/* Filter: Node: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = '1';
$handler->display->display_options['filters']['status']['group'] = 0;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['defaults']['use_ajax'] = FALSE;
$handler->display->display_options['use_ajax'] = TRUE;
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
$handler->display->display_options['style_plugin'] = 'table';
$handler->display->display_options['style_options']['columns'] = array(
'edit_node' => 'edit_node',
'timestamp' => 'edit_node',
'last_comment_timestamp' => 'edit_node',
'view_node' => 'edit_node',
);
$handler->display->display_options['style_options']['default'] = '-1';
$handler->display->display_options['style_options']['info'] = array(
'edit_node' => array(
'align' => '',
'separator' => '',
),
'timestamp' => array(
'align' => '',
'separator' => '',
),
'last_comment_timestamp' => array(
'sortable' => 0,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
),
'view_node' => array(
'align' => '',
'separator' => '',
),
);
$handler->display->display_options['style_options']['override'] = 1;
$handler->display->display_options['style_options']['sticky'] = 0;
$handler->display->display_options['style_options']['empty_table'] = 0;
$handler->display->display_options['defaults']['style_options'] = FALSE;
$handler->display->display_options['defaults']['row_plugin'] = FALSE;
$handler->display->display_options['defaults']['row_options'] = FALSE;
$handler->display->display_options['defaults']['fields'] = FALSE;
/* Field: Node: Edit link */
$handler->display->display_options['fields']['edit_node']['id'] = 'edit_node';
$handler->display->display_options['fields']['edit_node']['table'] = 'node';
$handler->display->display_options['fields']['edit_node']['field'] = 'edit_node';
$handler->display->display_options['fields']['edit_node']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['edit_node']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['edit_node']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['edit_node']['alter']['external'] = 0;
$handler->display->display_options['fields']['edit_node']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['edit_node']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['edit_node']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['edit_node']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['edit_node']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['edit_node']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['edit_node']['alter']['trim'] = 0;
$handler->display->display_options['fields']['edit_node']['alter']['html'] = 0;
$handler->display->display_options['fields']['edit_node']['element_label_colon'] = 1;
$handler->display->display_options['fields']['edit_node']['element_default_classes'] = 1;
$handler->display->display_options['fields']['edit_node']['hide_empty'] = 0;
$handler->display->display_options['fields']['edit_node']['empty_zero'] = 0;
/* Field: Node: Has new content */
$handler->display->display_options['fields']['timestamp']['id'] = 'timestamp';
$handler->display->display_options['fields']['timestamp']['table'] = 'history_user';
$handler->display->display_options['fields']['timestamp']['field'] = 'timestamp';
$handler->display->display_options['fields']['timestamp']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['timestamp']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['timestamp']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['timestamp']['alter']['external'] = 0;
$handler->display->display_options['fields']['timestamp']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['timestamp']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['timestamp']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['timestamp']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['timestamp']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['timestamp']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['timestamp']['alter']['trim'] = 0;
$handler->display->display_options['fields']['timestamp']['alter']['html'] = 0;
$handler->display->display_options['fields']['timestamp']['element_label_colon'] = 1;
$handler->display->display_options['fields']['timestamp']['element_default_classes'] = 1;
$handler->display->display_options['fields']['timestamp']['hide_empty'] = 0;
$handler->display->display_options['fields']['timestamp']['empty_zero'] = 0;
$handler->display->display_options['fields']['timestamp']['link_to_node'] = 0;
$handler->display->display_options['fields']['timestamp']['comments'] = 0;
/* Field: Node: Last comment time */
$handler->display->display_options['fields']['last_comment_timestamp']['id'] = 'last_comment_timestamp';
$handler->display->display_options['fields']['last_comment_timestamp']['table'] = 'node_comment_statistics';
$handler->display->display_options['fields']['last_comment_timestamp']['field'] = 'last_comment_timestamp';
$handler->display->display_options['fields']['last_comment_timestamp']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['last_comment_timestamp']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['last_comment_timestamp']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['last_comment_timestamp']['alter']['external'] = 0;
$handler->display->display_options['fields']['last_comment_timestamp']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['last_comment_timestamp']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['last_comment_timestamp']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['last_comment_timestamp']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['last_comment_timestamp']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['last_comment_timestamp']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['last_comment_timestamp']['alter']['trim'] = 0;
$handler->display->display_options['fields']['last_comment_timestamp']['alter']['html'] = 0;
$handler->display->display_options['fields']['last_comment_timestamp']['element_label_colon'] = 1;
$handler->display->display_options['fields']['last_comment_timestamp']['element_default_classes'] = 1;
$handler->display->display_options['fields']['last_comment_timestamp']['hide_empty'] = 0;
$handler->display->display_options['fields']['last_comment_timestamp']['empty_zero'] = 0;
/* Field: Node: Link */
$handler->display->display_options['fields']['view_node']['id'] = 'view_node';
$handler->display->display_options['fields']['view_node']['table'] = 'node';
$handler->display->display_options['fields']['view_node']['field'] = 'view_node';
$handler->display->display_options['fields']['view_node']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['view_node']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['view_node']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['view_node']['alter']['external'] = 0;
$handler->display->display_options['fields']['view_node']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['view_node']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['view_node']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['view_node']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['view_node']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['view_node']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['view_node']['alter']['trim'] = 0;
$handler->display->display_options['fields']['view_node']['alter']['html'] = 0;
$handler->display->display_options['fields']['view_node']['element_label_colon'] = 1;
$handler->display->display_options['fields']['view_node']['element_default_classes'] = 1;
$handler->display->display_options['fields']['view_node']['hide_empty'] = 0;
$handler->display->display_options['fields']['view_node']['empty_zero'] = 0;
$handler->display->display_options['path'] = 'index.html';

Majdi’s picture

Priority: Normal » Critical

example motors[dot]jo/car-finder.html try to move between pages

Majdi’s picture

Component: block displays » Miscellaneous
Majdi’s picture

Priority: Critical » Normal

Any idea how to solve that ?

light9’s picture

subscribe

Anonymous’s picture

Hi,

Hope this is a better description. If you have a view with multiple displays, all the other displays inherit whatever is in the default display after paging or filtering with Ajax on.

Example

Default is Unformatted and set to display 6 items

Block 1 is a Grid set to display 6 items with a pager and Ajax switched on.
When the pager is hit, the next set of items to be displayed will be unformatted but still 6 items.

Have no clue why its inheriting this, but thats what I got, so I fixed mine by building the Default as I wanted, and the Displays are replicas of the default. Not exactly the most efficient way, but for the moment, it works.

Equinger’s picture

subscribe!

Majdi’s picture

@kahenya Yes you right , But the way you used is not useful when you have many displays, Also if you check motors[dot]jo/car-finder.html you can see that the grouping of style table wont work in page 2

DeFr’s picture

Status: Active » Needs review
FileSize
833 bytes

I'm attaching a patch to fix this issue.

High level summary:

Things broke with the commit in http://drupalcode.org/project/views.git/commitdiff/6674a3f252b080511dfce... , which made get_title call init_style to fix some other issues with the tokens in the title. At the point where get_title() is called in ajax.inc though, the view never got assigned a display yet, so its initializing the styles with whatever happens to be in the default display.

Subsequent calls to init_style considers that the style was already set, and returns early, which means the the default display is kept 'till the final rendering.

The simplest fix seems to call $view->set_display explicitely before trying to get the title, so that's what attached patch does. That seems pretty much required to get the title of the display requested and not the default one anyway.

Hope that makes sense ?

DeFr’s picture

(For the record, it doesn't happen in 7.x-3.x because the code doesn't try to get the view title before the preview call)

DeFr’s picture

Title: Ajax paging in blocks breaks row style on paging » Ajax loaded views (via pager links, ...) use the style plugin of the default display
FileSize
1.05 KB

Having slept on it, there's still a small flaw with the patch in #13: the display is set before calling get_title, so the style plugins are correctly initialized, but at this point the view object still don't have any idea what its arguments are, so we may not get the right title.

Given that the order of the called is not constrained here, I'm attaching an even simpler fix: just call view::get_title after the preview call, which will let it set up both the current display and arguments correctly.

DeFr’s picture

FileSize
3.84 KB

To try to help move this issue forward, I'm attaching the export of a very simple views that should exhibit the problem out of the box with a freshly installed copy of core with 6.x-3.x-dev.

Steps to reproduce:

  1. Import the View
  2. Go to system-test, check that the table style is correctly used
  3. Click on the pager link to go to page 2
  4. The results are now displayed with the unformatted style

After step 4, checking that the patch attached in #15 does fix the issue should be pretty straightforward :-)

If there's anything else I can do to help get this fix, just let me know.

ckng’s picture

Patch #15 works for me.
Using quicktabs ajax loading of views, facing same problem.

dawehner’s picture

Does someone know whether this is a bug on 6.x-2.x?

I'm thinking whether it makes sense to apply this there as well.

DeFr’s picture

This bug kind of affect 6.x-2.x as well, but in a far less spectacular way: in 6.x-2.x, get_title only calls set_display('default') if no display was set, and doesn't try to init the styles; concretely, it means that the title returned by views_ajax is always the title of the default display, not the title of the specific display. I'm not sure there's anything that actually use the title contained in the JSON by default in Views though, so in the current state of 6.x-2.x, the bug is pretty much undetectable without manually inspecting the return value of the AJAX call.

After applying the same fix to 6.x-2.x, the JSON correctly contains the right title, so it does fix the smaller bug there as well; so, I would say go for it and apply the patch in #15 to both 6.x-2.x and 6.x-3.x.

asplamagnifique’s picture

Status: Needs review » Reviewed & tested by the community

Views 6.3 has been installed , in my project, in feb 2011.
After the module update, the theme disapeared on page 2 and more.
I’ve tested this patch and it fixed my problem, it’s good for me.

dawehner’s picture

Version: 6.x-3.x-dev » 7.x-3.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Commited to both branches and update status as this patch will not apply anymore to d7.

dawehner’s picture

It seems to be that this title isn't added anymore, but is also not needed. Would be cool if someone could clarify this.

DeFr’s picture

As stated in #14, this isn't needed in 7.x-3.x: the code stopped trying to get the view title independently, and uses the ajax framework introduced in D7 to replace the view content with the new output of the view. That's a rather radical but quite effective way to avoid this issue.

I would thus call it fix, but I'm a bit unclear about your comment in #22: did it apply to 7.x-3.x, in which case I've just answered it above, or did you mean that somehow you don't get titles any longer in 6.x-3.x, which would be a bug of some sort ?

dawehner’s picture

Status: Patch (to be ported) » Fixed

Just applied it to 6.x but didn't applied to 7.x

Thanks for clarifing that this doesn't need an update.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.