-
Notifications
You must be signed in to change notification settings - Fork 314
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
Support horizontal mode #7
Comments
Hi Could you please provide your Sortable Directives structure (How u use/embed it in html). Just wanted to have a Look. |
sortableOptions in controller: ...
scope.sortableOptions = {
accept: function (sourceItemHandleScope, descSortableScope) {
return sourceItemHandleScope.itemScope.sortableScope.$id === descSortableScope.$id;
},
orderChanged: function () {
scope[scope.formName].file.$setViewValue(scope[scope.formName].file.$viewValue);
}
};
... HTML structure: ...
<div id="media-images-{{formName}}" class="media-images-sortable"
ng-show="files.length > 0" sortable="sortableOptions" ng-model="files">
<div ng-repeat="file in files" sortable-item>
<div class="thumbnail thumbnail-media-image" sortable-item-handle>
<img class="thumb" width="100" height="100" ng-if="file.isNew"
ng-src="{{file.dataSrc}}">
<progressbar class="progress-striped active"
ng-show="file.process.value > 0 && !file.process.uploaded"
max="file.process.total" value="file.process.value"
ng-if="file.isNew">
{{file.process.value}} / {{file.process.total}}
</progressbar>
<media-image-viewer
image-src="/api/media/{{file.data.id}}/binaries/default_small.json"
image-width="100" image-height="100"
ng-if="!file.isNew"></media-image-viewer>
<a class="remove" ng-click="imageRemove(file)"><i
class="glyphicon glyphicon-remove-circle"></i></a>
</div>
</div>
</div>
... |
Just wanted to check you use one sortable directive for your images and you are achieving the horizontal look only by CSS. This is an interesting use case and I will definitely add support for horizontal mode. Thanks. |
@minhtdpro I had added the horizontal support, please install the latest version '1.1.0'. Let me know If this helps. Also you no need to implement the 'accept' callback in your Controller as you are using only one sortable list and not moving items across columns, the default is always 'true'. |
Thanks for help. It work perfect |
Do you have a jsfiddle or plunker with horizontal sorting working within one row? Auto-responding to myself, I did solve the horizontal issue by setting the display inline-block to the .as-sortable-placeholder, like follows (in Stylus)
|
Hi , yeah you can achieve the horizontal by some css style tweaks. I have this info in the README. |
I saw the Plunkr example but wasn't that clear to me. However, I could solve it by my own. I would suggest to update that section of the README to make it clearer. Thanks for your response. |
I use sortable directive to sort images like this:
![screenshot-127 0 0 1 9000 2014-07-01 11-31-03](https://cloud.githubusercontent.com/assets/5418628/3438981/5f7ac60e-00d9-11e4-85b7-78c349419ced.png)
with custom css :
but I can't drag & drop other item up to first item
![screenshot-127 0 0 1 9000 2014-07-01 11-32-51](https://cloud.githubusercontent.com/assets/5418628/3439038/a4fa1918-00da-11e4-8578-63d328ff7582.png)
Please add support horizontal mode. Thank!
The text was updated successfully, but these errors were encountered: