Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sanjeevkumar’s picture

FileSize
63.24 KB

When i unchecked " New items appear bottom " in draggable order setting to show New item at the top

All list show same weight for all node items of page
also not save draging position

is any one know the solution?
its very urgent for my project

sanjeevkumar’s picture

Title: draggableviews unchecked New items appear bottom of the list show same weight for all node order » draggableviews after unchecked " New items appear bottom of the list show" Drag value saved in data base but not show on page where i saved it
Issue tags: -draggableviews +draggableviews uncheck

In dragable views module I trying to show new item on top of drag page it shows but when i save page after drag any content it not show saved content and show next page content I am using view pager in drag drop page

the following code is to show new item on top used in draggable module
It show the content correctly but after save weight not show again

$this->query->add_orderby($this->table_alias, $this->real_field, $this->options['order']);

value is saving in database correctly

dcam’s picture

Project: Drupal core » DraggableViews
Version: 7.x-dev » 7.x-2.x-dev
Component: views.module » Code
Assigned: sanjeevkumar » Unassigned

Moving this issue to the DraggableViews issue queue.

Erica_der_Whatkin’s picture

Can you check that you don't have any of the columns set as sortable/default sort in the Views Format settings?

/me just spent a day and a half with the same issue.

iStryker’s picture

Title: draggableviews after unchecked " New items appear bottom of the list show" Drag value saved in data base but not show on page where i saved it » unchecked "New items appear bottom of the list show" causes bad order
Category: Bug report » Support request
Priority: Major » Normal
Issue tags: -draggableviews uncheck

I think your view it not built properly, as I just test the lastest dev and unchecking "New items appear bottom of the list" works

Are you using expose filters?
Are you using contextual filters?
Can you attach a simple view I/We can test?
Are you using fieldAPI or native handler?

Also if you create a new content item, its weight will be 0. If you create all the content then they will all have the same weight.

Move issue to support request. Will close issue if no response in 2 weeks.

iStryker’s picture

Status: Active » Postponed (maintainer needs more info)
jason@blaze’s picture

I've run into this problem a few times over the last few months. I am (currently) running Drupal 7.38, Views 7.x-3.11 and DraggableViews 7.x-2.1. I'm using the native handler to store the row weight.

If I check off New items appear bottom of the list, everything works fine, and the Views query looks like this (only showing the SELECT portion):

SELECT node.nid AS nid, node.title AS node_title, node.created AS node_created, node.changed AS node_changed, COALESCE(draggableviews_structure.weight, 2147483647) AS draggableviews_structure_weight_coalesce
FROM 
{node} node

However, if I leave it unchecked, the query looks like:

SELECT node.nid AS nid, node.title AS node_title, node.created AS node_created, node.changed AS node_changed, draggableviews_structure.weight AS draggableviews_structure_weight
FROM 
{node} node

Notice the difference in the alias... draggableviews_structure_weight_coalesce vs. draggableviews_structure_weight. This causes an issue in draggableviews_handler_native->get(), since it's looking specifically for
$row->draggableviews_structure_weight_coalesce:

public function get($field, $index) {
  $row = $field->view->result[$index];
  return (isset($row->draggableviews_structure_weight_coalesce)) ? $row->draggableviews_structure_weight_coalesce : 0;
}

I adjusted the code to the following for the time being, and it fixed my problem:

  public function get($field, $index) {
    $row = $field->view->result[$index];

    if (isset($row->draggableviews_structure_weight_coalesce)) {
      $result = $row->draggableviews_structure_weight_coalesce;
    }
    elseif (isset($row->draggableviews_structure_weight)) {
      $result = $row->draggableviews_structure_weight;
    }
    else {
      $result = 0;
    }

    return $result;
  }
iStryker’s picture

Suggestion looks sound. Makes me think if #1787764: Unknown column caused by orderby alias not matching field alias is still an issue. What if the alias is longing than 60 characters, then the result will always be 0.

jason@blaze’s picture

David_Rothstein’s picture

Category: Support request » Bug report
Status: Postponed (maintainer needs more info) » Needs review

This looks like a legitimate bug report with a patch, so I'm moving it to "needs review".

However, I think the patch in #2734155: Sorting using the native handler is broken in the latest dev version, especially when hierarchy is used will also fix this as a side effect.