<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # 列表排序操作 ### 介紹 **重新排序行為**是控制器修飾符,它提供了對數據庫記錄進行排序和重新排序的功能。該行為提供了一個使用controller動作的頁面,稱為Reorder`reorder`。此頁面顯示帶有拖動手柄的記錄列表,允許對它們進行排序并在某些情況下進行重組。 該行為取決于必須實現以下[模型特征](https://octobercms.com/docs/database/traits)之一的[模型類](https://octobercms.com/docs/database/model):[](https://octobercms.com/docs/database/traits) 1. `October\Rain\Database\Traits\Sortable` 2. `October\Rain\Database\Traits\NestedTree` 為了使用重新排序行為,應將其添加到`$implement`控制器類的屬性中。另外,`$reorderConfig`應該定義class屬性,并且其值應引用用于配置行為選項的YAML文件。 ~~~ namespace Acme\Shop\Controllers; class Categories extends Controller { public $implement = [ 'Backend.Behaviors.ReorderController', ]; public $reorderConfig = 'config_reorder.yaml'; // [...] } ~~~ ### [](https://octobercms.com/docs/backend/reorder#configuring-reorder)配置行為 `$reorderConfig`屬性中引用的配置文件以YAML格式定義。該文件應放置在控制器的[views目錄中](https://octobercms.com/docs/backend/controllers-ajax/#introduction)。以下是配置文件的示例: ~~~ # =================================== # Reorder Behavior Config # =================================== # Reorder Title title: Reorder Categories # Attribute name nameFrom: title # Model Class name modelClass: Acme\Shop\Models\Category # Toolbar widget configuration toolbar: # Partial for toolbar buttons buttons: reorder_toolbar ~~~ 可以使用下面列出的配置選項。 | 選項 | 描述 | | --- | --- | | **title** | 用于頁面標題。 | | **nameFrom** | 指定應將哪個屬性用作每個記錄的標簽。 | | **modelClass** | 一個模型類名,記錄數據就是從這個模型加載的。 | | **toolbar** | 引用工具欄窗口小部件配置文件或具有配置的數組。 | ### [](https://octobercms.com/docs/backend/reorder#reorder-display)顯示重新訂購頁面 您應該提供一個名為**reorder.htm**的[視圖文件](https://octobercms.com/docs/backend/controllers-ajax/#introduction)。該視圖代表“重新排序”頁面,該頁面允許用戶對記錄進行重新排序。由于重新排序包括工具欄,因此視圖文件將僅包含單個方法調用。`reorderRender` ~~~ <?= $this->reorderRender() ?> ~~~ ### [](https://octobercms.com/docs/backend/reorder#override-sortable-partials)覆蓋可排序部分 如果您需要覆蓋重新訂購頁面的默認視圖,則必須復制 1. `modules/backend/behaviors/reordercontroller/partials/_container.htm` 2. `modules/backend/behaviors/reordercontroller/partials/_records.htm` 在 1. `plugins/yournamespace/yourplugin/yoursortablecontroller/_reorder_container.htm` 2. `plugins/yournamespace/yourplugin/yoursortablecontroller/_reorder_records.htm` ### [](https://octobercms.com/docs/backend/reorder#extend-model-query)擴展模型查詢 可以通過覆蓋控制器類內部的方法來擴展對列表[數據庫模型](https://octobercms.com/docs/database/model)的查找查詢`reorderExtendQuery`。通過將**withTrashed**范圍應用于查詢,此示例將確保軟刪除的記錄包括在列表數據中: ~~~ public function reorderExtendQuery($query) { $query->withTrashed(); } ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看