Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reorder setup #223

Closed
AurelDragut opened this issue Nov 4, 2016 · 9 comments
Closed

reorder setup #223

AurelDragut opened this issue Nov 4, 2016 · 9 comments

Comments

@AurelDragut
Copy link

Guys, i still have problems with the reorder feature.
I have setup strict to false in the mysql config, but i also saw something about some parent_id, lft, rgt, depth fields added to the model?!

@tabacitu
Copy link
Member

tabacitu commented Nov 6, 2016

Hi @AurelDragut ,

Could you be more specific, please? What's the problem you're facing?

Cheers!

@AurelDragut
Copy link
Author

Sure, @tabacitu,

I made a fresh install of backpack, i added a CRUD for "sections", i changed "strict" from true to false (i remembered you once told me about it) and i tried to reorder the sections (not before setting those two lines about item to reorder, level and access). I have received the same error regarding the "item_id" that i wrote about here before.

So i went on the documentation site to see if maybe i missed something and so i have seen this...

image

so i did something like this

image

(i even added my self "order" data but with no luck - the page column is empty because of missconfigured select column but that's another story)

@tabacitu
Copy link
Member

tabacitu commented Nov 6, 2016

That all sounds good to me. That's the correct procedure. But you forgot to say what the error/problem is. Again :-))

So Here's a shot in the dark - have you used the CrudTrait on the model?

<?php

namespace Backpack\MenuCRUD\app\Models;

use Illuminate\Database\Eloquent\Model;
use Backpack\CRUD\CrudTrait;

class MenuItem extends Model
{
    use CrudTrait;

    protected $table = 'menu_items';
    protected $fillable = ['name', 'type', 'link', 'page_id', 'parent_id'];

@AurelDragut
Copy link
Author

AurelDragut commented Nov 6, 2016

When i push Save after reordering i get the alert (Your order nas not been saved) and in the logs i see this:

[2016-11-06 18:33:39] local.ERROR: exception 'ErrorException' with message 'Undefined index: item_id' in /home/menduit/public_html/vendor/backpack/crud/src/PanelTraits/Reorder.php:25

i checked the model file it looks like in your example

@tabacitu
Copy link
Member

tabacitu commented Nov 6, 2016

Hmm... item_id is the input name used by NestedSortable (the js plugin). Without that, no way it would work.

  1. Do you have any javascript errors in your console?
  2. Have you modified the reorder.blade.php in any way?
  3. Have you modified the saveReorder() method in your CrudController in any way?

Cheers!

@AurelDragut
Copy link
Author

AurelDragut commented Nov 6, 2016

  1. i get this in the console: (ignore the first line - it's chrome stuff and its not related)
    image

2)i didn't modify any of the reorder.blade.php or CrudController

@tabacitu
Copy link
Member

tabacitu commented Nov 7, 2016

Okaaay. Now we're onto it. So it's an error in the saveReorder() method or when trying to call it. And if you click the URL what does the error say?

@AurelDragut
Copy link
Author

I think it might be a server security issue, let me check with the hosting company and i will get back to you. (I see something about a xhr error when i click there)

@AurelDragut
Copy link
Author

AurelDragut commented Nov 7, 2016

Wow, it seems it was a problem with the PHP version (i guess i had a previous version configured that they changed to 5.6).

Sorry about this, at least i can hope that maybe someone else runs into the same situation and will find out about how to do it by reading this.

This was referenced Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants