dcasia/column-toggler

Toggle menu doesn't appears

Closed this issue · 11 comments

Can't make it appear.
Any suggestion?
Thank you

Composer.json:
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"php": "^8.1",
"barryvdh/laravel-dompdf": "^2.0",
"degecko/nova-filters-summary": "^2.0",
"digital-creative/column-toggler": "^0.1.1",
"guzzlehttp/guzzle": "^7.2",
"kabbouchi/nova-logs-tool": "^2.2",
"laravel/framework": "^10.0",
"laravel/nova": "~4.0",
"laravel/sanctum": "^3.2",
"laravel/tinker": "^2.8",
"maatwebsite/excel": "^3.1",
"maatwebsite/laravel-nova-excel": "^1.3",
"padocia/laravel-nova-pdf": "^1.0",
"spatie/laravel-permission": "^5.10",
"vyuldashev/nova-permission": "^3.2",
"waynestate/nova-text-copy-field": "^2.0"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.9",
"barryvdh/laravel-ide-helper": "^2.13",
"fakerphp/faker": "^1.9.1",
"laravel/pint": "^1.0",
"laravel/sail": "^1.18",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^7.0",
"phpunit/phpunit": "^10.0",
"spatie/laravel-ignition": "^2.0"
},
"autoload": {
"psr-4": {
"App\": "app/",
"Database\Factories\": "database/factories/",
"Database\Seeders\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\Foundation\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force",
"@php artisan nova:publish",
"@php artisan ide-helper:generate",
"@php artisan ide-helper:meta",
"@php artisan ide-helper:models --nowrite"
],
"post-root-package-install": [
"@php -r "file_exists('.env') || copy('.env.example', '.env');""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
],
"post-install-cmd": [
"@php artisan ide-helper:generate",
"@php artisan ide-helper:meta",
"@php artisan ide-helper:models --nowrite"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true,
"php-http/discovery": true
}
},
"minimum-stability": "stable",
"prefer-stable": true,
"repositories": {
"nova": {
"type": "composer",
"url": "https://nova.laravel.com"
}
}
}

Screenshot 2023-11-23 at 19 51 30

  • Are you using the latest version of this package?
  • Did you add the ColumnTogglerTrait to your resource?
  • Latest package: Yes it has the latest commit released "ColumnTogglerTrait.php"
    public function serializeForIndex(NovaRequest $request, $fields = null): array

  • Did you add the ColumnTogglerTrait to your resource?: Yes (in my previeous screenshot i see te "Column toggler" but with no options
    Screenshot 2023-11-24 at 08 53 01

I have installed all your packages to see if there was any conflict with them and nothing there... I can only assume then is your laravel nova version is not latest? what version number are you at?

This is my version:

image

Unfortunately i have the same:

Screenshot 2023-11-24 at 10 40 48

Any other suggestion? Thank you very much.

Okay so perhaps could you help debug a few things:

  • What is the output if you add dd($columns) here?

$columns = $indexFields->map(fn (Field $field) => [
'attribute' => $this->generateAttributeName($field),
'label' => $field->name,
'visible' => data_get($field->meta(), 'columnToggleVisible', true),
]);

  • If you check your network tab you can see a request that loads the data of your resource, can you see if there is a columnToggler key injected?

It is a get request that should look something like this (where users should be the name of your resource):

https://dashboard.docker.localhost/nova-api/users?search=&filters=...
image
  • Can you double-check you don't see any JS errors on your browser console?
image

No JS errors:
Screenshot 2023-11-24 at 11 16 32

The request show results for column toggler:
Screenshot 2023-11-24 at 11 14 14

the dd($columns):
Screenshot 2023-11-24 at 11 19 44

So I am really clueless about the issue and I'm unable to replicate it locally... are you able to give access to your code to debug it further? or perhaps do a screen sharing via Google Meet to debug it live?

Hi, thank for all your effort!

I put here the entire folder:
https://password.link/vwuGolG/#eyRpbV90dG0kTGZbXnliZj9F

Let me know if you find the issue.
Thanks

image

Your composer.json has the old version of the package installed:

-"digital-creative/column-toggler": "^0.1.1"
+"digital-creative/column-toggler": "^0.2",

Sorry, i though it was on the latest one. Still not working.

Screenshot 2023-11-24 at 14 55 46

It's now working! I'm not sure why, but i run some updates... upgrades and it's now working fine. Probably related with the outdated version and something else. Thank you for all your effort in helping with a problem that for sure was in my side. And thank you for your excellent feature.