mirror of
https://github.com/Microsoft/sql-server-samples.git
synced 2025-12-08 14:58:54 +00:00
Refactored IVS, React and Todo Apps
This commit is contained in:
@@ -52,7 +52,7 @@ namespace Register.Controllers
|
||||
public async Task People()
|
||||
{
|
||||
await this
|
||||
.ODataHandler(tableSpec, this.pipe, ODataHandler.Metadata.MINIMAL)
|
||||
.OData(tableSpec, this.pipe, ODataHandler.Metadata.MINIMAL)
|
||||
.OnError(ex => Response.Body.Write(Encoding.UTF8.GetBytes(ex.Message), 0, (ex.Message).Length))
|
||||
.Get();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Belgrade.SqlClient;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlServerRestApi;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
// For more information on enabling Web API for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
|
||||
@@ -38,7 +39,7 @@ namespace Register.Controllers
|
||||
{
|
||||
Response.ContentType = "application/json";
|
||||
await this
|
||||
.ODataHandler(tableSpec, pipe)
|
||||
.OData(tableSpec, pipe)
|
||||
.Process();
|
||||
}
|
||||
|
||||
@@ -52,7 +53,8 @@ namespace Register.Controllers
|
||||
public async Task Get()
|
||||
{
|
||||
await this
|
||||
.JQueryDataTablesHandler(tableSpec, pipe)
|
||||
.JQueryDataTables(tableSpec, pipe)
|
||||
.OnError(ex => Response.Body.Write(Encoding.UTF8.GetBytes(ex.Message), 0, ex.Message.Length))
|
||||
.Process();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"Microsoft.Extensions.Logging.Console": "1.0.0",
|
||||
"Microsoft.Extensions.Logging.Debug": "1.0.0",
|
||||
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
|
||||
"Sql-Server-Rest-Api": "0.3.1"
|
||||
"Sql-Server-Rest-Api": "0.3.3"
|
||||
},
|
||||
|
||||
"tools": {
|
||||
|
||||
+57
-13
@@ -1,12 +1,58 @@
|
||||
$.fn.dataTableExt.oPagination.incremental = {
|
||||
/*
|
||||
* Function: oPagination.incremental.fnInit
|
||||
* Purpose: Initalise dom elements required for pagination with a list of the pages
|
||||
* Returns: -
|
||||
* Inputs: object:oSettings - dataTables settings object
|
||||
* node:nPaging - the DIV which contains this pagination control
|
||||
* function:fnCallbackDraw - draw function which must be called on update
|
||||
*/
|
||||
/**
|
||||
* This pagination style shows Previous/Next buttons, and page numbers only
|
||||
* for "known" pages that are visited at least once time using [Next>] button.
|
||||
* Initially only Prev/Next buttons are shown (Prev is initially disabled).
|
||||
*
|
||||
* [<Previous] [Next>]
|
||||
*
|
||||
* When user navigates through the pages using [Next>] button, navigation shows
|
||||
* the numbers for the previous pages. As an example, when user reaches page 2,
|
||||
* page numbers 1 and 2 are shown:
|
||||
*
|
||||
* [<Previous] 1 2 [Next>]
|
||||
*
|
||||
* When user reaches page 4, page numbers 1, 2, 3, and 4 are shown:
|
||||
*
|
||||
* [<Previous] 1 2 3 4 [Next>]
|
||||
*
|
||||
* When user navigates back, pagination will remember the last page number
|
||||
* he reached and the numbesr up to the last known page are shown. As an example,
|
||||
* when user returns to the page 2, page numbers 1, 2, 3, and 4 are still shown:
|
||||
*
|
||||
* [<Previous] 1 2 3 4 [Next>]
|
||||
*
|
||||
* This pagination style is designed for users who will not directly jump to
|
||||
* the random page that they have not opened before. Assumption is that users
|
||||
* will discover new pages using [Next>] button. This pagination enables users
|
||||
* to easily go back and forth to any page that they discovered.
|
||||
*
|
||||
* Key benefit: This pagination supports usual pagination pattern and does not
|
||||
* require server to return total count of items just to calculate last page and
|
||||
* all numbers. This migh be huge performance benefit because server does not
|
||||
* need to execute two queries in server-side processing mode:
|
||||
* - One to get the records that will be shown on the current page,
|
||||
* - Second to get the total count just to calculate full pagination.
|
||||
*
|
||||
* Without second query, page load time might be 2x faster, especially in cases
|
||||
* when server can quickly get top 100 records, but it would need to scan entire
|
||||
* database table just to calculate the total count and position of the last
|
||||
* page. This pagination style is reasonable trade-off between simple and fullnumbers
|
||||
* pagination.
|
||||
*
|
||||
* @name Simple Incremental navigation (Bootstrap)
|
||||
* @summary Shows forward/back buttons and all known page numbers.
|
||||
* @author [Jovan Popovic](http://github.com/JocaPC)
|
||||
*
|
||||
* @example
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "pagingType": "simple_incremental_bootstrap"
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
|
||||
$.fn.dataTableExt.oPagination.simple_incremental_bootstrap = {
|
||||
|
||||
"fnInit": function (oSettings, nPaging, fnCallbackDraw) {
|
||||
$(nPaging).prepend($("<ul class=\"pagination\"></ul>"));
|
||||
var ul = $("ul", $(nPaging));
|
||||
@@ -21,7 +67,6 @@
|
||||
nFirst.className = "paginate_button first active";
|
||||
nPrevious.className = "paginate_button previous";
|
||||
nNext.className = "paginate_button next";
|
||||
|
||||
|
||||
ul.append(nPrevious);
|
||||
ul.append(nFirst);
|
||||
@@ -64,9 +109,8 @@
|
||||
},
|
||||
|
||||
/*
|
||||
* Function: oPagination.incremental.fnUpdate
|
||||
* Function: oPagination.simple_incremental_bootstrap.fnUpdate
|
||||
* Purpose: Update the list of page buttons shows
|
||||
* Returns: -
|
||||
* Inputs: object:oSettings - dataTables settings object
|
||||
* function:fnCallbackDraw - draw function which must be called on update
|
||||
*/
|
||||
@@ -107,4 +151,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -17,7 +17,7 @@
|
||||
<script src="media/js/lib/Bootstrap.js"></script>
|
||||
<script src="media/js/lib/jquery.dataTables.js"></script>
|
||||
<script src="media/js/lib/jquery.dataTables.Bootstrap.js"></script>
|
||||
<script src="media/js/lib/jquery.dataTables.incremental_pagination.js"></script>
|
||||
<script src="media/js/lib/simple_incremental_bootstrap.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" class="init">
|
||||
@@ -33,7 +33,7 @@ $(document).ready(function() {
|
||||
var table = $('#example').DataTable({
|
||||
"serverSide": true,
|
||||
"processing": true,
|
||||
"pagingType": "incremental",
|
||||
"pagingType": "simple_incremental_bootstrap",
|
||||
"ajax": "/api/People",
|
||||
"columns": [
|
||||
{ "data": "name", "width": "10%" },
|
||||
|
||||
Reference in New Issue
Block a user