%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/opti/workflow/src/public/app-assets/js/scripts/tables/jsgrid/
Upload File :
Create Path :
Current File : /home/opti/workflow/src/public/app-assets/js/scripts/tables/jsgrid/jsgrid.min.js

/*!
 * stack-admin-theme (https://pixinvent.com/bootstrap-admin-template/stack)
 * Copyright 2018 PIXINVENT
 * Licensed under the Themeforest Standard Licenses
 */
$(document).ready(function(){$("#basicScenario").jsGrid({width:"100%",filtering:!0,editing:!0,inserting:!0,sorting:!0,paging:!0,autoload:!0,pageSize:15,pageButtonCount:5,deleteConfirm:"Do you really want to delete the client?",controller:db,fields:[{name:"Name",type:"text",width:150},{name:"Age",type:"number",width:50},{name:"Address",type:"text",width:200},{name:"Country",type:"select",items:db.countries,valueField:"Id",textField:"Name"},{name:"Married",type:"checkbox",title:"Is Married",sorting:!1},{type:"control"}]}),$("#serviceScenario").jsGrid({height:"auto",width:"100%",sorting:!0,paging:!1,autoload:!0,controller:{loadData:function(){var d=$.Deferred();return $.ajax({url:"http://services.odata.org/V3/(S(3mnweai3qldmghnzfshavfok))/OData/OData.svc/Products",dataType:"json"}).done(function(response){d.resolve(response.value)}),d.promise()}},fields:[{name:"Name",type:"text"},{name:"Description",type:"textarea",width:150},{name:"Rating",type:"number",width:50,align:"center",itemTemplate:function(value){return $("<div>").addClass("rating").append(Array(value+1).join("&#9733;"))}},{name:"Price",type:"number",width:50,itemTemplate:function(value){return value.toFixed(2)+"$"}}]}),$("#sorting-table").jsGrid({height:"400px",width:"100%",autoload:!0,selecting:!1,controller:db,fields:[{name:"Name",type:"text",width:150},{name:"Age",type:"number",width:50},{name:"Address",type:"text",width:200},{name:"Country",type:"select",items:db.countries,valueField:"Id",textField:"Name"},{name:"Married",type:"checkbox",title:"Is Married"}]}),$("#sort").on("click",function(){var field=$("#sortingField").val();$("#sorting-table").jsGrid("sort",field)}),$("#validation").jsGrid({width:"100%",filtering:!0,editing:!0,inserting:!0,sorting:!0,paging:!0,autoload:!0,pageSize:15,pageButtonCount:5,deleteConfirm:"Do you really want to delete the client?",controller:db,fields:[{name:"Name",type:"text",width:150,validate:"required"},{name:"Age",type:"number",width:50,validate:{validator:"range",param:[18,80]}},{name:"Address",type:"text",width:200,validate:{validator:"rangeLength",param:[10,250]}},{name:"Country",type:"select",items:db.countries,valueField:"Id",textField:"Name",validate:{message:"Country should be specified",validator:function(value){return value>0}}},{name:"Married",type:"checkbox",title:"Is Married",sorting:!1},{type:"control"}]}),$("#loading").jsGrid({width:"100%",autoload:!0,paging:!0,pageLoading:!0,pageSize:15,pageIndex:2,controller:{loadData:function(filter){var startIndex=(filter.pageIndex-1)*filter.pageSize;return{data:db.clients.slice(startIndex,startIndex+filter.pageSize),itemsCount:db.clients.length}}},fields:[{name:"Name",type:"text",width:150},{name:"Age",type:"number",width:50},{name:"Address",type:"text",width:200},{name:"Country",type:"select",items:db.countries,valueField:"Id",textField:"Name"},{name:"Married",type:"checkbox",title:"Is Married"}]}),$("#pager").on("change",function(){var page=parseInt($(this).val(),10);$("#loading").jsGrid("openPage",page)}),$("#customView").jsGrid({width:"100%",filtering:!0,editing:!0,sorting:!0,paging:!0,autoload:!0,pageSize:15,pageButtonCount:5,controller:db,fields:[{name:"Name",type:"text",width:150},{name:"Age",type:"number",width:50},{name:"Address",type:"text",width:200},{name:"Country",type:"select",items:db.countries,valueField:"Id",textField:"Name"},{name:"Married",type:"checkbox",title:"Is Married",sorting:!1},{type:"control",modeSwitchButton:!1,editButton:!1}]}),$(".config-panel input[type=checkbox]").on("click",function(){var $cb=$(this);$("#customView").jsGrid("option",$cb.attr("id"),$cb.is(":checked"))}),$("#batchDelete").jsGrid({width:"100%",autoload:!0,confirmDeleting:!1,paging:!0,controller:{loadData:function(){return db.clients}},fields:[{headerTemplate:function(){return $("<button>").attr("type","button").text("Delete").addClass("btn btn-primary mr-1").on("click",function(){deleteSelectedItems()})},itemTemplate:function(_,item){return $("<input>").attr("type","checkbox").prop("checked",$.inArray(item,selectedItems)>-1).on("change",function(){$(this).is(":checked")?selectItem(item):unselectItem(item)})},align:"center",width:50},{name:"Name",type:"text",width:150},{name:"Age",type:"number",width:50},{name:"Address",type:"text",width:200}]});var selectedItems=[],selectItem=function(item){selectedItems.push(item)},unselectItem=function(item){selectedItems=$.grep(selectedItems,function(i){return i!==item})},deleteSelectedItems=function(){if(selectedItems.length&&confirm("Are you sure?")){deleteClientsFromDb(selectedItems);var $grid=$("#batchDelete");$grid.jsGrid("option","pageIndex",1),$grid.jsGrid("loadData"),selectedItems=[]}},deleteClientsFromDb=function(deletingClients){db.clients=$.map(db.clients,function(client){return $.inArray(client,deletingClients)>-1?null:client})};$("#external").jsGrid({width:"100%",paging:!0,pageSize:15,pageButtonCount:5,pagerContainer:"#externalPager",pagerFormat:"current page: {pageIndex} &nbsp;&nbsp; {first} {prev} {pages} {next} {last} &nbsp;&nbsp; total pages: {pageCount}",pagePrevText:"<",pageNextText:">",pageFirstText:"<<",pageLastText:">>",pageNavigatorNextText:"&#8230;",pageNavigatorPrevText:"&#8230;",data:db.clients,fields:[{name:"Name",type:"text",width:150},{name:"Age",type:"number",width:50},{name:"Address",type:"text",width:200},{name:"Country",type:"select",items:db.countries,valueField:"Id",textField:"Name"},{name:"Married",type:"checkbox",title:"Is Married"}]})});

Zerion Mini Shell 1.0