Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
z-song authored Jun 25, 2019
1 parent 652ba92 commit e1bfbd5
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
laravel-admin grid-sortable
======

This extension can help you sort by dragging the rows of the data list, the front end is based on [jQueryUI sortable](https://jqueryui.com/sortable/), and the back end is based on [eloquent-sortable](https://github.com/spatie/eloquent-sortable)

这个插件可以帮助你通过拖动数据列表的行来进行排序,前端基于[jQueryUI sortable](https://jqueryui.com/sortable/), 后端基于[eloquent-sortable](https://github.com/spatie/eloquent-sortable)

![Kapture 2019-06-25 at 10 14 51](https://user-images.githubusercontent.com/1479100/60064224-50b97080-9732-11e9-8023-431fc6fe81a5.gif)
Expand All @@ -11,16 +13,15 @@ laravel-admin grid-sortable
composer require laravel-admin-ext/grid-sortable -vvv
```

发布静态资源
Publish asserts

```shell
php artisan vendor:publish --provider="Encore\Admin\GridSortable\GridSortableServiceProvider"
```


## Usage

定义模型
Define your model

```php
<?php
Expand All @@ -40,28 +41,26 @@ class MyModel extends Model implements Sortable
}
```

在Grid中使用
Use in grid

```php
$grid = new Grid(new MyModel);

$grid->sortable();
```

这样会给表格增加一列排序列,拖动之后在表格顶部会出现一个Save order的按钮,点击保存排序
This will add a column to the grid. After dragging one row, a `Save order` button will appear at the top of the grid. Click to save order.

## Translation

排序保存按钮默认的文字是`Save order`,如果使用其他语言,比如简体中文,那么可以在`resources/lang/zh-CN.json`文件中增加一项翻译
The default text for the button is `Save order`. If you use an other language, such as Simplified Chinese, you can add a translation to the `resources/lang/zh-CN.json` file.

```json
{
"Save order": "保存排序"
}
```

其他语言也是按照上面的方式操作。

## Donate

> Help keeping the project development going, by donating a little. Thanks in advance.
Expand Down

0 comments on commit e1bfbd5

Please sign in to comment.