table ->defaultSort()

->columns([])
->defaultSort('created_at', 'desc')
->columns([])
->defaultSort('created_at', 'desc')
this works correctly, however, when I edit an item in the table, the edited item jumps to the top of the table (it changes position) but I am sorting by created_at so editing the record should not change the order of the table.
7 Replies
Dennis Koch
Dennis Koch3mo ago
You didn't change the sort by clicking a table column? Can you maybe share a video?
Giant Robo
Giant RoboOP3mo ago
->defaultSort('created_at', 'desc')
->defaultSort('created_at', 'desc')
if I upload say, 3 new videos, when editing one, that one will change position, but the 3 videos themselves still stay at the top this behaviour remains even if I edit in a modal or slideover
Dennis Koch
Dennis Koch3mo ago
They are created in the exact same second? Is that the issue?
Giant Robo
Giant RoboOP3mo ago
yes! they are! I created records in groups how should create if I create 10 at 1 time?
MyType::create([])
MyType::create([])
Dennis Koch
Dennis Koch3mo ago
Can you try with different time? Does it still move? I guess it falls back to updated_at as a second param, since created_at is the same. You could manually add some time.
Giant Robo
Giant RoboOP3mo ago
I need a unique timestamp for laravel timestamps() in the migration I'll ask in laravel forums
Dennis Koch
Dennis Koch3mo ago
You can just manually pass the time.

Did you find this page helpful?