Comments (16)
hello, have you used my column class? and additional question, can you show how you created dataProvidel
? it's ArrayDataProvider?
from yii2-sortable-widgets.
little bit explanation:
1
, 0
, 2
from your screen, should be ID of models, no keys is correct values.
what ID you have in your CRUD? could you look data-id
attribute in Sortable column?
from yii2-sortable-widgets.
Thanks for your quick answer.
Yes, I used your column class. My dataProvider is an ArrayDataProvider:
$dataProvider = new ArrayDataProvider([ 'allModels' => $model->kapitel, 'sort' => [ 'attributes' => ['id', 'username', 'email'], ], 'pagination' => [ 'pageSize' => 10, ], ]);
But 1,0,2 is not the id of my models, it's the new sorting order. How does the update method know, which id is concerned?
This is how my table column looks like...
from yii2-sortable-widgets.
Why I thought the ID is missing: This is how the sorting in my yii1 grid worked.
from yii2-sortable-widgets.
You have used another extension for yii1. I did another approach. So, I will check this problem today and will be back to you.
from yii2-sortable-widgets.
Did you find out enything?
from yii2-sortable-widgets.
hello, yes. could you change https://github.com/kotchuprik/yii2-sortable-widgets/blob/master/assets/files/js/sortable-widgets.js#L5 to data-id
in your local file? and check sorting again?
from yii2-sortable-widgets.
Nothing has changed, sorry (I think I already tested that).
from yii2-sortable-widgets.
could you to do composer update, add rowOptions
and check again? I've found problem with using ArrayDataProvider
from yii2-sortable-widgets.
Explain to me please. I can not sort the list. But when I add a parameter in the query string ?sort=order, then the list is sorted. Where this option is added in the code? Like this...
public function actions()
{
return [
'sorting' => [
'class' => \kotchuprik\sortable\actions\Sorting::className(),
'query' => \common\modules\test\models\Test::find()->addOrderBy('order'),
],
];
}
from yii2-sortable-widgets.
Please, look the example addOrderBy
is no needs. What with your post request now?
from yii2-sortable-widgets.
How should work sorting?
"Order" is changed immediately when perestanoke? I only changed when to reload the page. Lines menyut its position when moving. But the value of the field does not change the order. This is when the parameter ?sort=order.
Request URL:http://yiistart/backend/test/test/sorting/
FORM DATA
/index/?sort=order
sorting[]:8
sorting[]:9
sorting%5B%5D=8&sorting%5B%5D=9
sorting[]:9
sorting[]:8
sorting%5B%5D=9&sorting%5B%5D=8
/index
sorting[]:8
sorting[]:9
sorting%5B%5D=8&sorting%5B%5D=9
sorting[]:9
sorting[]:8
sorting%5B%5D=9&sorting%5B%5D=8
from yii2-sortable-widgets.
perestanoke, menyut — google translate RU-EN? :)
I don't understand your question. What do you want know?
You have next elements: 45, 94, 100. When you will swap 45 and 100, the extension will send:
sorting[]: 100
sorting[]: 94
sorting[]: 45
It means next 1st order for 100, 2nd order for 94 and 3rd order for 45. Number of position in array will be order for element.
From your example:
Before:
sorting[]:8
sorting[]:9
After:
sorting[]:9
sorting[]:8
It means that you have swapped 8 and 9. New order for 9 will be 1, for 8 will be 2.
from yii2-sortable-widgets.
I want to say that I have retained only if the permutation of the query string is the next attribute
?sort=order.
That is, I do sort by order.
A value in the column "order" changes only when you restart the page
from yii2-sortable-widgets.
yes, now it works! Thank you 👍
from yii2-sortable-widgets.
awesome :)
from yii2-sortable-widgets.
Related Issues (16)
- Replace used lib
- Wrong sort when enabled pagination HOT 10
- composer HOT 3
- Не заработало HOT 1
- How update GridView after ajax? HOT 2
- kartik gridview HOT 1
- way to make order field always start from zero vs. increment from highest order record HOT 1
- Willl this work for table with composite key? HOT 3
- Ошибка при использовании виджета HOT 3
- checkbox states when sorting rows HOT 8
- checkbox behaviour when sorting
- Doesn`t load Sortable.min.js HOT 4
- sortable within on "parent" HOT 1
- can you set cdn file to widgets folder?
- After save: position has wrong value HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yii2-sortable-widgets.