예제 #1
0
        public DatatableRecords GetPagedRecords(DatatableFilters filters)
        {
            // Let's create the actual data to go into the table
            List <string[]> dtData = new List <string[]>();

            for (int i = 0; i < 15; i++)
            {
                dtData.Add(new string[] {
                    string.Format("first column paged row {0}", i + 1),
                    string.Format("second column paged row {0}", i + 1)
                });
            }

            DatatableRecords dtRecords = new DatatableRecords
            {
                sEcho                = filters.sEcho,
                iTotalRecords        = dtData.Count(),              // Total records in table
                iTotalDisplayRecords = dtData.Count(),              // Total records to be displayed in the table
                aaData               = dtData
                                       .Skip(filters.iDisplayStart) // The data to be displayed
                                       .Take(filters.iDisplayLength)
                                       .ToArray()
            };

            return(dtRecords);
        }
예제 #2
0
        //
        // GET: /JQueryUI/Core/GetPostbackData
        public virtual JsonResult GetPostbackData(DatatableFilters filters, PostbackSetupViewModel postbacks)
        {
            IEnumerable <string[]> dtData = new string[][]
            {
                new string[] { "first column row 1", "second column row 1" },
                new string[] { "first column row 2", "second column row 2" },
                new string[] { "first column row 3", "second column row 3" },
                new string[] { "first column row 4", "second column row 4" }
            };

            if (!string.IsNullOrEmpty(postbacks.FirstColumn))
            {
                dtData = dtData.Where(f => f[0].ContainsIgnoreCase(postbacks.FirstColumn));
            }
            if (!string.IsNullOrEmpty(postbacks.SecondColumn))
            {
                dtData = dtData.Where(f => f[1].ContainsIgnoreCase(postbacks.SecondColumn));
            }

            DatatableRecords dtRecords = new DatatableRecords
            {
                sEcho                = filters.sEcho,
                iTotalRecords        = dtData.Count(),
                iTotalDisplayRecords = dtData.Count(),
                aaData               = dtData.ToArray()
            };

            return(Json(dtRecords, JsonRequestBehavior.AllowGet));
        }
예제 #3
0
        public DatatableRecords GetSortedRecords(DatatableFilters filters)
        {
            // Let's create the actual data to go into the table
            IList <string[]> dtData = DatatableGenerator.GetDataWithSpecialFormat();

            DatatableRecords dtRecords = new DatatableRecords
            {
                sEcho                = filters.sEcho,
                iTotalRecords        = dtData.Count(),                                  // Total records in table
                iTotalDisplayRecords = dtData.Count(),                                  // Total records to be displayed in the table
                aaData               = dtData
                                       .Sort(filters.iSortCol_0, filters.SortDirection) // The data to be displayed
                                       .ToArray()
            };

            return(dtRecords);
        }
예제 #4
0
        //
        // GET: /Bootstrap/Core/GetAjaxData
        public virtual JsonResult GetAjaxData(DatatableFilters filters)
        {
            // Let's create the actual data to go into the table
            string[][] dtData = new string[][]
            {
                new string[] { "first column ajax row 1", "second column ajax row 1" },
                new string[] { "first column ajax row 2", "second column ajax row 2" }
            };

            DatatableRecords dtRecords = new DatatableRecords
            {
                sEcho                = filters.sEcho,
                iTotalRecords        = dtData.Length,                                 // Total records in table
                iTotalDisplayRecords = dtData.Length,                                 // Total records to be displayed in the table
                aaData               = dtData                                         // The data to be displayed
            };

            return(Json(dtRecords, JsonRequestBehavior.AllowGet));
        }
예제 #5
0
        //
        // GET: /Bootstrap/Core/GetSortedData
        public virtual JsonResult GetSortedData(DatatableFilters filters)
        {
            DatatableRecords dtRecords = GetSortedRecords(filters);

            return(Json(dtRecords, JsonRequestBehavior.AllowGet));
        }