- ๐บ๐ธUnited States erutan
The patches in this issue queue no longer work in Drupal 10.3.10.
#21 applied cleanly, but there were no options for sortable tables and no sortable tables automatically.
#19 popped up the following error multiple times when loading the entity with the field I want to sort in the admin edit interface:
Warning: Undefined property: stdClass::$field_tr_receiver_test_data_sortable in Drupal\Core\Entity\Sql\SqlContentEntityStorage->loadFromDedicatedTables() (line 1269 of /app/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php) #0 /app/web/core/includes/bootstrap.inc(166): _drupal_error_handler_real(2, 'Undefined prope...', '/app/web/core/l...', 1269) #1 /app/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(1269): _drupal_error_handler(2, 'Undefined prope...', '/app/web/core/l...', 1269) #2 /app/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(503): Drupal\Core\Entity\Sql\SqlContentEntityStorage->loadFromDedicatedTables(Array, false) #3 /app/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(428): Drupal\Core\Entity\Sql\SqlContentEntityStorage->mapFromStorageRecords(Array) #4 /app/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(394): Drupal\Core\Entity\Sql\SqlContentEntityStorage->getFromStorage(Array) #5 /app/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(312): Drupal\Core\Entity\Sql\SqlContentEntityStorage->doLoadMultiple(Array) #6 /app/web/core/modules/views/src/Plugin/views/query/Sql.php(1632): Drupal\Core\Entity\EntityStorageBase->loadMultiple(Array) #7 /app/web/core/modules/views/src/Plugin/views/query/Sql.php(1557): Drupal\views\Plugin\views\query\Sql->loadEntities(Array) #8 /app/web/core/modules/views/src/ViewExecutable.php(1486): Drupal\views\Plugin\views\query\Sql->execute(Object(Drupal\views\ViewExecutable)) #9 /app/web/core/modules/views/src/ViewExecutable.php(1514): Drupal\views\ViewExecutable->execute(NULL) #10 /app/web/core/modules/views/src/Plugin/views/display/Page.php(201): Drupal\views\ViewExecutable->render() #11 /app/web/core/modules/views/src/ViewExecutable.php(1690): Drupal\views\Plugin\views\display\Page->execute() #12 /app/web/core/modules/views/src/Element/View.php(81): Drupal\views\ViewExecutable->executeDisplay('storage_page_li...', Array) #13 [internal function]: Drupal\views\Element\View::preRenderViewElement(Array) #14 /app/web/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(113): call_user_func_array(Array, Array) #15 /app/web/core/lib/Drupal/Core/Render/Renderer.php(870): Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_ren...', 'exception', 'Drupal\\Core\\Ren...') #16 /app/web/core/lib/Drupal/Core/Render/Renderer.php(432): Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) #17 /app/web/core/lib/Drupal/Core/Render/Renderer.php(248): Drupal\Core\Render\Renderer->doRender(Array, false) #18 /app/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(238): Drupal\Core\Render\Renderer->render(Array, false) #19 /app/web/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() #20 /app/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(231): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #21 /app/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(128): Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch)) #22 /app/web/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch)) #23 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher)) #24 /app/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher)) #25 /app/vendor/symfony/http-kernel/HttpKernel.php(186): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view') #26 /app/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #27 /app/web/modules/contrib/redirect_after_login/src/RedirectMiddleware.php(44): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #28 /app/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Drupal\redirect_after_login\RedirectMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #29 /app/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #30 /app/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #31 /app/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #32 /app/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #33 /app/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #34 /app/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #35 /app/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #36 /app/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #37 /app/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #38 /app/web/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #39 /app/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #40 {main}
Furthermore if I go to edit a tablefield @ /admin/structure/storage_types/foo/edit/fields/ I get a whitescreen with the following:
The website encountered an unexpected error. Try again later. Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'foo_bar_sortable' in 'where clause': SELECT 1 AS "expression" FROM "storage_revision__foo_bar" "t" WHERE ("foo_bar_value" IS NOT NULL) OR ("foo_bar_format" IS NOT NULL) OR ("foo_bar_caption" IS NOT NULL) OR ("foo_bar_sortable" IS NOT NULL) LIMIT 1 OFFSET 0; Array ( ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->countFieldData() (line 1794 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
- ๐บ๐ธUnited States erutan
#19 is loading the JS lib, tr/td have a different background color and there are grey triangles to use as sort toggles, but it is not interactive.
- ๐ง๐ชBelgium tim-diels Belgium ๐ง๐ช
Patch from #17 and patch from #21 are quiet different.
What is the expected approach here to have table sorting added? I see the module uses the Tablesorter โ module for the 7.x version and that was the same as with patch from #17 but the person in #21 decided on itself that they wanted to go a different approach without explaining why.
I'm more of a fan of using the Tablesorter โ module as this is also what the maintainer proposed on using. So can we have a concensus on using this approach?
- Merge request !28Add patch from #17 from douggreen that uses tablesorter for sorting โ (Open) created by tim-diels
- ๐ง๐ชBelgium tim-diels Belgium ๐ง๐ช
Added patch from #17 to the latest codebase so going to hide all other patches.
I think a nice follow up would be a setting to allow to specify what columns should be sortable as the library supports this. But that could be a separate issue so this can go in as is and the change is not to big. - ๐ง๐ชBelgium tim-diels Belgium ๐ง๐ช
The code works for me, only no visual for sorting. Is this something that is needed for the tablesorter module itself or it could be added here as done in the 7.x branch. The tablesorter said is is something the theme should fix. So maybe just some documentation and just the cursor set to pointer?
Setting to needs work for the css.
- ๐ง๐ชBelgium tim-diels Belgium ๐ง๐ช
We can also suggest installing the tablesorter in a composer file...
- ๐บ๐ธUnited States erutan
Would it be more appropriate if the functionality of this patch was a submodule included with TableField?
If someone installs TableField Sort (or some other name) then we can have tablesorter installed as a dependency. This wouldn't impact people that don't want the functionality while making it simpler for those that do.
There isn't a stable build of tablesorter for D8+, but the 2.0 branch is up to RC2 and around a third of the people using the module โ are running that branch.
- ๐ง๐ชBelgium tim-diels Belgium ๐ง๐ช
@erutan I do like your suggestion. But can't put time in this now to completely refactor it to be a submodule. If a maintainer could assist in deciding what would be the best approach, then we can see what we need to do to get this finished.
I understand that there is no proper release for tablesorter. I'll try to get some time to get a proper release there. I would suggest not yet adding this to a release until there is a proper release of tablesorter.
The CSS I did not add as I think this is not necessary as a theme could handle this? Any opinions on that?
Setting this to needs review as in my eyes it seems complete now.
- Status changed to Needs work
about 2 months ago 2:55pm 15 February 2025 - ๐จ๐ฆCanada Liam Morland Ontario, CA ๐จ๐ฆ
Please rebase on 3.0.x.
- ๐ฎ๐ณIndia prem suthar Ahemdabad- Gujrat , Jodhpur - Rajsthan
prem suthar โ made their first commit to this issueโs fork.
- ๐ฎ๐ณIndia prem suthar Ahemdabad- Gujrat , Jodhpur - Rajsthan
prem suthar โ changed the visibility of the branch 1491584-sort-option-would to hidden.
- ๐ช๐ธSpain Carlos Romero
carlos romero โ made their first commit to this issueโs fork.
- ๐จ๐ฆCanada Liam Morland Ontario, CA ๐จ๐ฆ
I don't think there is going to be any more development of 8.x-2.x. Merge request 56 is for 3.0.x. This version needs tests to all pass.