本文整理匯總了TypeScript中GridClient.GridClient類的典型用法代碼示例。如果您正苦於以下問題:TypeScript GridClient類的具體用法?TypeScript GridClient怎麽用?TypeScript GridClient使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了GridClient類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: require
$(document).ready(function () {
// require the GridClient module (which mimicks a normal client page)
var __lg2 = require('GridClient');
// find the element we will place the grid in
var $grid = $('.mygrid');
// find the element we will place any (grid) debug-comments in
var $comment = $('.comment-text');
// create a new instance of the DEMO grid class which explains how to setup the light grid
var newGrid = new __lg2.GridClient();
// prepare some data
newGrid.prepare();
// disable the apply button until grid is created
$("#apply").attr('disabled', 'disabled');
// act on user clicking createGrid button
$('#btnCreateGrid').click(function () {
// remove the create grid button
$('#btnCreateGrid').remove();
// enable the apply button
$("#apply").removeAttr("disabled");
// and tell it to create a grid inside the designated element
newGrid.createGrid($grid, $comment);
// find the element we will place any (grid) debug-comments in
var rowcount = $('.rowcount').val();
// repopulate the data
newGrid.populateData(rowcount);
});
// now listen for Apply button clicks
$('#apply').click(function () {
// find the element we will place any (grid) debug-comments in
var rowcount = $('.rowcount').val();
// sanity check
if (rowcount < 0 || rowcount > 50000) {
// something is wrong so reset it back to 1000 rows!
$('.rowcount').val("1000");
// reset the number of rows to 1000 and inform the user with a red-ish banner
rowcount = 1000;
$comment.text("please select a number of rows below 50000 (and over zero)");
$comment.css('background-color', "rgb(253, 175, 175)");
// start a 3 seconds wait then re-popuplate
setTimeout(function () {
$comment.css('background-color', "");
newGrid.populateData(rowcount);
}, 3000);
return;
}
// repopulate the data
newGrid.populateData(rowcount);
});
});
示例2: setTimeout
$('#apply').click(function () {
// find the element we will place any (grid) debug-comments in
var rowcount = $('.rowcount').val();
// sanity check
if (rowcount < 0 || rowcount > 50000) {
// something is wrong so reset it back to 1000 rows!
$('.rowcount').val("1000");
// reset the number of rows to 1000 and inform the user with a red-ish banner
rowcount = 1000;
$comment.text("please select a number of rows below 50000 (and over zero)");
$comment.css('background-color', "rgb(253, 175, 175)");
// start a 3 seconds wait then re-popuplate
setTimeout(function () {
$comment.css('background-color', "");
newGrid.populateData(rowcount);
}, 3000);
return;
}
// repopulate the data
newGrid.populateData(rowcount);
});
示例3:
$('#btnCreateGrid').click(function () {
// remove the create grid button
$('#btnCreateGrid').remove();
// enable the apply button
$("#apply").removeAttr("disabled");
// and tell it to create a grid inside the designated element
newGrid.createGrid($grid, $comment);
// find the element we will place any (grid) debug-comments in
var rowcount = $('.rowcount').val();
// repopulate the data
newGrid.populateData(rowcount);
});