Esempio n. 1
0
        public IActionResult Index()
        {
            var dataProviderUrl = Url.Action("DataTables");
            var viewModel       = DataTablesHelper.DataTableVm <JabatanOrmawaRow>("dataTable", dataProviderUrl);

            viewModel.ShowFilterInput = true;
            viewModel.PageLength      = 10;

            vmod.DataTableConfigVm = viewModel;

            return(View(vmod));
        }
Esempio n. 2
0
        public IActionResult DataTablesExample()
        {
            OrganisasiOrmawaVM vmod = new OrganisasiOrmawaVM();
            var dataProviderUrl     = Url.Action("DataTablesExampleDataProvider");
            var viewModel           = DataTablesHelper.DataTableVm <OrganisasiOrmawaRow>("dataTable", dataProviderUrl);

            viewModel.ShowFilterInput = true;
            viewModel.PageLength      = 10;

            vmod.DataTableConfigVm = viewModel;

            return(View(vmod));
        }
Esempio n. 3
0
        protected virtual DataTableConfigVm ConfigureDataTable()
        {
            var getDataUrl = Url.Action(nameof(this.GetTableData));
            var vm         = DataTablesHelper.DataTableVm <T>(BuildTableID(), getDataUrl);

            vm.Filter          = true;
            vm.ShowFilterInput = true;

            vm.TableTools = false;

            vm.LengthMenu = LengthMenuVm.Default();
            vm.PageLength = 10;

            vm.ColVis = false;

            return(vm);
        }
        public ActionResult Index()
        {
            var getDataUrl = Url.Action(nameof(HomeController.GetUsers));
            var vm         = DataTablesHelper.DataTableVm <UserTableRowViewModel>("idForTableElement", getDataUrl);


            //but you can also set them in a typed fashion:

            vm.Filter          = true; //Enable filtering
            vm.ShowFilterInput = true; //Show or hide the search-across-all-columns input

            //Use the advanced per-column filter plugin
            vm.UseColumnFilterPlugin = true;

            vm //Fluently configure, or use attributes on the ViewModel
            .FilterOn("Position", new { sSelector = "#custom-filter-placeholder-position" }, new { sSearch = "Tester" }).Select("Engineer", "Tester", "Manager")
            .FilterOn("Id").NumberRange()
            .FilterOn("Salary", new { sSelector = "#custom-filter-placeholder-salary" }).NumberRange();


            //You can set options on the datatable in an untyped way:
            //  vm.JsOptions.Add("iDisplayLength", 25);
            //  vm.JsOptions.Add("aLengthMenu", new object[] { new[] {5, 10, 25, 250, -1} , new object[] { 5, 10, 25, 250, "All"} });
            vm.JsOptions.Add("fnCreatedRow", new Raw(@"function( nRow, aData, iDataIndex ) {
        $(nRow).attr('data-id', aData[0]);
    }"));

            //Enable localstorage based saving filter/sort/paging state
            vm.StateSave = true;

            //you can change the page length options...
            vm.LengthMenu = LengthMenuVm.Default();     // 5,10,25,50,All
            vm.LengthMenu.RemoveAll(t => t.Item2 == 5); //Take out 5
            vm.PageLength = 25;                         //... and set a default

            //Enable column visibility
            vm.ColVis = true;
            vm.ShowVisibleColumnPicker = true; //Displays a control for showing/hiding columns


            //Localizable
            if (Request.QueryString["lang"] == "de")
            {
                //vm.Language = "{ 'sUrl': '" + Url.Content("~/Content/jquery.dataTables.lang.de-DE.txt") + "' }";
                vm.Language = new Language
                {
                    sProcessing   = "Bitte warten...",
                    sLengthMenu   = "_MENU_ Einträge anzeigen",
                    sZeroRecords  = "Keine Einträge vorhanden.",
                    sInfo         = "_START_ bis _END_ von _TOTAL_ Einträgen",
                    sInfoEmpty    = "0 bis 0 von 0 Einträgen",
                    sInfoFiltered = "(gefiltert von _MAX_  Einträgen)",
                    sInfoPostFix  = "",
                    sSearch       = "Suchen",
                    sUrl          = "",
                    oPaginate     = new Paginate()
                    {
                        sFirst    = "Erster",
                        sPrevious = "Zurück",
                        sNext     = "Weiter",
                        sLast     = "Letzter"
                    }
                }.ToJsonString();
            }
            return(View(vm));
        }