Таблица фильтра с select2 (каждый столбец кратен) - PullRequest
0 голосов
/ 11 февраля 2019

Я хочу добавить фильтр в мою таблицу.Для каждого столбца muptiple select2.Но не знаю всех табличных значений (это строка от пользователя).Все фильтры работают одновременно.Я нахожу некоторый пример, но с опциями в коде (option value = "1" Item 1 / option), а не из таблицы (DataCollection_Aktive dataSource).Параметры просмотра должны быть уникальными.Моя архитектура mvvm, но я советую с решением в архитектуре mvc.Я новичок, пожалуйста, просто.

View is:
 <div class="div">
        <table class="table">
            <thead class="thread">
                <tr>
                    <th class="th" id="_header">Action</th>
                    <th class="th" id="2_header">Two</th>
                    <th class="th" id="3_header">Tree</th>
                    <th class="th" id="4_header">Four</th>
                    <th class="th" id="5_header">Five</th>

                </tr>
            </thead>
            <tbody>
                @foreach (var item in Model.DataCollection_Aktive)
                {
                    <tr>
                        <th class="body_th" style="font-size: 17px; vertical-align:middle">
                            @Html.ActionLink("Edit", "Edit", new { id = item.Id })
                        </th>
                        <td class="td">
                            @Convert.ToString(item.Column_two)
                        </td>
                        <td class="td">
                            @Convert.ToString(item.Column_tree)
                        </td>
                        <td class="td">
                            @Convert.ToString(item.Column_four)
                        </td>
                        <td class="td">
                            @Convert.ToString(item.Column_five)
                        </td>
                    </tr>
                }
            </tbody>
        </table>
    </div>

ViewModel is:

public List<Aktive_WP> DataCollection_Aktive { get; set; }

Controller is:

namespace M_ref.Controllers

{

    public class M_refController : Controller

    {

        private M_ref_Data db = new M_ref_Data();

        // GET: M_ref

        public ActionResult M_ref()

        {

            var dataColAktiv = db.Aktives.ToList();

            M_refViewModel vm = new M_refViewModel 


{ DataCollection_Aktive = dataColAktiv };


            vm.HandleRequest();

            return View(vm);

        }
    }
}
...