Not sure if this is supposed to be working yet or not, but building a simple table view with just the node title and teaser I can't get click sorting working -- there is no clickable link for click sorting showing up in the table.

I am trying to see where to fix this and still working on it, but I thought I'd post what I have so far in case I'm going down the wrong path.

I can see the place in the code where the click sorting should be getting done in plugins.inc in options() and options_column() and build_sort() in views_plugin_style_table. But options() and options_column() never get triggered. It looks like when we get to build_sort() the options are already set, but wrong (they're the page options instead of the table options), and the code there just checks if options already exist and then exits without doing anything with the table options.

So I backed up to the basic view handling in view() in view.inc and looked at the init_style() function there and it looks like it is grabbing the page style first, which has its own set of style options and it is those style options that are getting through. Not sure what to do next. It seems like the plugin options should override the display options or maybe they need to be merged???

I'll keep digging around, but maybe that's enough to tell where to look next. I'm a little foggy about what *should* be happening here.

CommentFileSizeAuthor
#3 screenshot.JPG36.79 KBkarens
#3 export.txt2.79 KBkarens

Comments

karens’s picture

er, not options_column() but options_form(), I was looking at the place where the columns were being built in options_form().

merlinofchaos’s picture

Click-sorting is completely working on every view I've tested it with (which is actually many; tables are very convenient for testing). So I'm not sure why it's not working for you.

options() is triggered only when a new field is created; it's used to set default options.

options_form() is triggered only when the plugin or handler is edited; it's used to display the form.

views_handler_plugin_style_table::build_sort() should be called, and it reads the $_GET arguments, determines who should get called, and eventually calls views_field_handler::click_sort() to let the handler do the appropriate work.

karens’s picture

StatusFileSize
new2.79 KB
new36.79 KB

This is weird. Just to be sure I hadn't polluted things with my CCK and Date module changes, I created a clean install with nothing but core and Views (latest cvs of both), created a couple nodes and a simple view showing a table with the title and teaser and no other changes to the default views setup. There is no way to click sort it. I went back and added a sort to the view (in case that mattered somehow) but still no click sorting. I also went back and set it up to use Ajax, in case that mattered somehow, but that didn't have any effect either.

Click sorting works fine elsewhere, like in the Views UI.

I've attached a screen shot and the view export.

I'm using Windows XP, php 5.2.5, mysql 5.0.51.

merlinofchaos’s picture

Hm. It doesn't look like the table options are actually set to *be* sortable. Here's an example of what thet able options look like when columns are set sortable:

  'style_options' => 
  array (
    'override' => 1,
    'order' => 'asc',
    'columns' => 
    array (
      'name' => 'name',
      'uid' => 'uid',
      'mail' => 'mail',
    ),
    'info' => 
    array (
      'name' => 
      array (
        'sortable' => 1,
        'separator' => '',
      ),
      'uid' => 
      array (
        'sortable' => 1,
        'separator' => '',
      ),
      'mail' => 
      array (
        'sortable' => 1,
        'separator' => '',
      ),
    ),
    'default' => 'uid',
  ),
karens’s picture

I'm not seeing any option to do that anywhere, where should I see it?

merlinofchaos’s picture

There should be an settings button to the right of the table style setting.

There you can make all kinds of changes to the table including combining fields into columns. There is a checkbox for sortable and a radio to select the default sort.

karens’s picture

No settings button anywhere for the table, that's the key problem then. Where should I see that exactly?

karens’s picture

Never mind, now I figured it out, it's that little wheel icon. I had no idea what that was, missed it completely.

I'll play around with that now.

karens’s picture

Title: Table click sorting not working » Clarify what the settings button is and does
Category: bug » task

OK, It works fine, it was my misunderstanding, not a bug at all.

But maybe a task to make it easier to understand what the settings button is and does, since there's not even a tooltip to explain it. I'm assuming that if I didn't get it, there will be others that don't :)

karens’s picture

Looking at this some more, I think part of the reason I kept overlooking the settings button is because it is off to the right all by itself with no visual connection to anything. I see now that there is a tooltip, but it only says 'Settings' and it shows up in a section called 'Basic settings' so it is not obvious that it would be a link to something else, plus I'm using Firefox where the tooltip doesn't show up unless you stay on it for a minute.

So my suggestions for improvement would be:

1) Expand the tooltip to say things like 'Specify settings for your table.' or 'Set advanced settings for this style.' to make it more clear.

2) Move the settings icon to the left, next to the name of the style so it is more clear that they go together.

3) Add a link to settings in the section where you select the style and add a label to it there that says 'Advance settings for this style' which will make it easy to find and also make it more clear what the icon means when you see it elsewhere.

If that sounds good, I can attempt a patch, but I am lousy at ajax and don't know if I know exactly how to do it, so I wouldn't mind if someone who *does* know ajax tried to roll a patch instead.

merlinofchaos’s picture

Status: Active » Fixed

I added a tooltip and a note to look over there; I'm not sure moving the icon to the left is a good idea but it's something to consider as well. For now I will mark this fixed.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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