•  » Engine
  •  » Use of data-selectize to create categories dropdown in batch manager

#1 2021-07-10 06:28:54

windracer
Member
St. Pete, FL
2014-12-28
493

Use of data-selectize to create categories dropdown in batch manager

I am attempting to update my Physical Photo Move plug-in, switching from the static categoryList class to the data-selectize option that's used by the Move/Associate actions in Batch Manager, so that the list of albums is nicer and you can type to search.

I am filtering the list of categories to only show physical albums:

Code:

function ppm_list_physical_albums()
{
  $query = '
  SELECT
      id,
      name,
      uppercats,
      global_rank
    FROM '.CATEGORIES_TABLE. '
    WHERE dir IS NOT NULL
  ;';
  $cat_selected = 0;
  display_select_cat_wrapper($query, $cat_selected, 'categories', true);
}

In my batch_global.tpl, when I use:

Code:

  <select data-selectize="categories" name="cat_id" placeholder="{'Select a physical album... or type it!'|@translate}">
    {html_options options=$categories selected=$categories_selected}
  </select>

I get the proper list of values, but they are apparently being sorted by the value (cat_id) so they are not listed in proper alphabetical order mirroring the folder structure, even though in the resulting generated source code, they are listed in the proper order:

https://www.windracer.net/outgoing/piwigo/data-selectize01.jpg

My current plug-in uses categoryList:

Code:

  <select class="categoryList" name="cat_id" size="10">
    {html_options options=$categories selected=$categories_selected}
  </select>

So if I try that:

Code:

  <select data-selectize="categoryList" name="cat_id" placeholder="{'Select a physical album... or type it!'|@translate}">
    {html_options options=$categories selected=$categories_selected}
  </select>

The categories are properly ordered BUT I can't type in the box to search and for some reason the drop-down appears above the field instead of below it (but that could be some other page rendering thing).

https://www.windracer.net/outgoing/piwigo/data-selectize02.jpg

In both cases, the dropdown defaults to selecting the first category in the list (in this example, "Places") instead of being empty with the placeholder text like what you see with Move or Associate. That's a lesser issue but I'd like for the dropdown to start empty so the user can either click to list the categories, or start typing to search.

What am I missing here to get this to work the way I want?

Offline

 

#2 2021-07-13 02:12:46

windracer
Member
St. Pete, FL
2014-12-28
493

Re: Use of data-selectize to create categories dropdown in batch manager

No suggestions? I have kept trying to figure this out and cannot get it to work the way I want ...

Any pointers on where I can read up/learn how this is supposed to work?

Last edited by windracer (2021-07-13 02:13:09)

Offline

 

#3 2021-07-23 02:19:59

windracer
Member
St. Pete, FL
2014-12-28
493

Re: Use of data-selectize to create categories dropdown in batch manager

I am by no means a CSS/Smarty expert. Still trying to figure out the selectize-data issue but also trying to add the similar type-or-pick-from-list control on my admin.tpl for the plug-in on the normal single photo page and cannot get it to work. Is there any suggested documentation I can review on how to get this to work and properly formatted?

Offline

 

#4 2024-09-09 21:34:34

windracer
Member
St. Pete, FL
2014-12-28
493

Re: Use of data-selectize to create categories dropdown in batch manager

I have still had no lucky figuring this out. The same thing is happening under the Piwigo 15 beta (I was hoping maybe it would magically work).

If anyone has any ideas, please let me know!

[Github] Piwigo-physical_photo_move issue #27
[Github] Piwigo-physical_photo_move issue #26

Offline

 
  •  » Engine
  •  » Use of data-selectize to create categories dropdown in batch manager

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact