Javascript 为什么";“列选择器”;页脚(导航栅格)中的图标不可见?(jqGrid)
我是jqGrid的新手,上周才开始使用。我有点不明白为什么列选择器不可见。我尝试了3种不同的列选择器脚本,但没有成功。然后,我今天上午下载了最新的jqGrid版本,但运气不好-(看来我对jquery和jqgrid的了解还不够,无法让它正常工作。谢谢Javascript 为什么";“列选择器”;页脚(导航栅格)中的图标不可见?(jqGrid),javascript,jquery,jqgrid,Javascript,Jquery,Jqgrid,我是jqGrid的新手,上周才开始使用。我有点不明白为什么列选择器不可见。我尝试了3种不同的列选择器脚本,但没有成功。然后,我今天上午下载了最新的jqGrid版本,但运气不好-(看来我对jquery和jqgrid的了解还不够,无法让它正常工作。谢谢 <!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<!-- This force IE to use the latest version of HTML, CSS and JavaScript instead of being forced to use 1 specific IE version only -->
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Blah</title>
<link rel="stylesheet" type="text/css" href="css/jquery-ui-v1.10.3.themes/base/minified/jquery-ui.min.css" />
<link rel="stylesheet" type="text/css" href="css/jqgrid-v4.5.0/ui.jqgrid.css" />
<link rel="stylesheet" type="text/css" href="css/jqgrid-v4.5.0/ui.multiselect.css" />
<script type="text/javascript" src="scripts/jquery-v2.0.0.min.js"></script>
<script src="scripts/jquery-ui-v1.10.3/minified/jquery-ui.min.js" type="text/javascript"></script>
<script src="scripts/jqgrid-v4.5.0/i18n/grid.locale-en.js" type="text/javascript"></script>
<!--<script src="scripts/jqgrid-v4.5.0/jquery.jqGrid.min.js" type="text/javascript"></script>-->
<script src="scripts/jqgrid-v4.5.0/jquery.jqGrid.src.js" type="text/javascript"></script>
<script src="scripts/jqgrid-v4.5.0/ui.multiselect.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
var jqgridSpreadsheetId = $('#MyInventoryJqgrid_Spreadsheet');
var jqgridPagerId = $('#MyInventoryJqgrid_Pager');
////jqGrid Column Chooser / JQuery Multiselect Plugin...
////http://www.trirand.com/jqgridwiki/doku.php?id=wiki:jquery_ui_methods&s[]=column&s[]=chooser...
//jqgridSpreadsheetId.extend({
// columnChooser: function (opts) {
// opts = $.extended({
// "title": 'Select columns',
// "width": 200,
// "height": 400,
// //classname: '',
// "done": function (parm) { if (perm) { self.jqgrid("remapColumns", perm, true); } },
// "msel": "multiselect"//,
// //dlog: '',
// //dlog_opts: '',
// //cleanup: function () { }
// });
// }
//});
//jqGrid Plugin...
//http://www.trirand.com...
jqgridSpreadsheetId.jqGrid({
url: '../websrvc/JqGrid.ashx',
datatype: 'json',
mtype: 'POST',
postData: { WhichJqgridTemplate: '<%=JqqridTools.Template.MyInventory%>', WhichAction: '<%=JqqridTools.Action.Display%>' },
colNames: ['Id','Stock Number','VIN','Year','Make','Model','Trim','Mileage','Purchase Price','Stock Date','Repair Cost','Total Cost','Days In Inventory'], //Display Text in Column Header...
colModel: [
//In this case, use "sorttype" property in "colModel" for it to work when "loadonce" is set to true...
{ name: 'Id', index: 'Id', hidden: true, sorttype: 'int', width: 0, align: 'left' },
{ name: 'StockNumber', index: 'StockNumber', sorttype: 'text', width: 100, align: 'left' },
{ name: 'Vin', index: 'Vin', sorttype: 'text', width: 140, align: 'left' },
{ name: 'Year', index: 'Year', sorttype: 'int', width: 50, align: 'left' },
{ name: 'Make', index: 'Make', sorttype: 'text', width: 80, align: 'left' },
{ name: 'Model', index: 'Model', sorttype: 'text', width: 80, align: 'left' },
{ name: 'Trim', index: 'Trim', sorttype: 'text', width: 100, align: 'left' },
{ name: 'Mileage', index: 'Mileage', sorttype: 'int', width: 60, align: 'left' },
{ name: 'PurchasePrice', index: 'PurchasePrice', sorttype: 'currency', width: 60, align: 'left' },
{ name: 'StockDate', index: 'StockDate', sorttype: 'date', width: 80, align: 'left', formatter: 'date', formatoptions: { newformat: 'm/d/Y' } }, //"formatter" and "formatoptions" is required for date sorting to works properly...
{ name: 'RepairCost', index: 'RepairCost', sorttype: 'currency', width: 60, align: 'left' },
{ name: 'TotalCost', index: 'TotalCost', sorttype: 'currency', width: 60, align: 'left' },
{ name: 'DaysInInventory', index: 'DaysInInventory', sorttype: 'int', width: 65, align: 'left' }
],
pager: jqgridPagerId,
rowNum: 10,
rowList: [5, 10, 20, 50], //Drop-down selection in footer - To show how many rows per page...
//sortname: 'StockDate',
//sortorder: 'desc',
sortname: 'Vin',
sortorder: 'desc',
viewrecords: true,
//gridview: true,
imgpath: '',
caption: 'My Inventory',
width: 1022,
shrinkToFit: false,
height: 200,
sortable: true, /* This allows both 1) Moving columns sideway to other location fields and 2) for jqGrid Column Chooser Plugin / JQuery Multiselect Plugin to work... */
loadonce: true, //In this case, use "sorttype" property in "colModel" for it to work when "loadonce" is set to true...
loadError: function (xhr, st, err) {
//alert("Type: " + st + "; Response: " + xhr.state + "; Status: " + xhr.statusTeext + "; Error: " + err);
alert("An error had occurred, please try again or notify webmaster of this error");
}
}).jqGrid('navButtonAdd', jqgridPagerId, {
caption: 'ddd',
buttonicon: 'ui-icon-calculator',
title: 'choose columns',
onClickButton: function () {
jqgridSpreadsheetId.jqGrid('columnChooser');
}
});
//Navigation Buttons...
/*
$('#' + jqgridSpreadsheetId).jqGrid('navButtonAdd', '#' + jqgridPagerId, {
caption: "dd",
buttonicon: "ui-icon-calculator",
title: "choose columns",
onclickButton: function () {
$(this).jqGrid('columnChooser', {
done: function (perm) {
if (perm) {
this.jqGrid("remapColumns", perm, true);
saveColumnState.call(this.perm);
}
}
});
}
});
*/
});
</script>
</head>
<body>
<table id="MyInventoryJqgrid_Spreadsheet" class="scroll"></table>
<div id="MyInventoryJqgrid_Pager" class="scroll" style="text-align:center;"></div>
</body>
</html>
废话
$(文档).ready(函数(){
var jqgridSpreadsheetId=$(“#MyInventoryJqgrid_电子表格”);
var jqgridPagerId=$('MyInventoryJqgrid_Pager');
////jqGrid列选择器/JQuery Multiselect插件。。。
////http://www.trirand.com/jqgridwiki/doku.php?id=wiki:jquery_ui_methods&s[]=列和s[]=选择器。。。
//jqgridSpreadsheetId.extend({
//columnChooser:函数(选项){
//opts=$.extended({
//“标题”:“选择列”,
//“宽度”:200,
//“高度”:400,
////类名:“”,
//“done”:函数(parm){if(perm){self.jqgrid(“remapColumns”,perm,true);},
//“msel”:“多选”//,
////dlog:“”,
////dlog_选择:“”,
////清除:函数(){}
// });
// }
//});
//jqGrid插件。。。
//http://www.trirand.com...
jqgridSpreadsheetId.jqGrid({
url:“../websrvc/JqGrid.ashx”,
数据类型:“json”,
mtype:“POST”,
postData:{WhichJqgridTemplate:'',WhichAction:''},
colNames:['Id'、'Stock Number'、'VIN'、'Year'、'Make'、'Model'、'Trim'、'Milege'、'Purchase'、'Stock Date'、'Repair Cost'、'Total Cost'、'Days In Inventory'],//在列标题中显示文本。。。
colModel:[
//在这种情况下,使用“colModel”中的“sorttype”属性,使其在“loadonce”设置为true时工作。。。
{name:'Id',index:'Id',hidden:true,sorttype:'int',width:0,align:'left'},
{名称:'StockNumber',索引:'StockNumber',排序类型:'text',宽度:100,对齐:'left'},
{名称:'Vin',索引:'Vin',排序类型:'text',宽度:140,对齐:'left'},
{名称:'Year',索引:'Year',排序类型:'int',宽度:50,对齐:'left'},
{name:'Make',index:'Make',sorttype:'text',宽度:80,align:'left'},
{name:'Model',index:'Model',sorttype:'text',宽度:80,align:'left'},
{name:'Trim',index:'Trim',sorttype:'text',宽度:100,align:'left'},
{name:'miliness',index:'miliness',sorttype:'int',width:60,align:'left'},
{name:'PurchasePrice',index:'PurchasePrice',sorttype:'currency',width:60,align:'left'},
{name:'StockDate',index:'StockDate',sorttype:'date',width:80,align:'left',formatter:'date',formattoptions:{newformat:'m/d/Y'}},//“formatter”和“formattoptions”是日期排序正常工作所必需的。。。
{name:'RepairCost',index:'RepairCost',sorttype:'currency',宽度:60,align:'left'},
{name:'TotalCost',index:'TotalCost',sorttype:'currency',width:60,align:'left'},
{name:'DaysInInventory',index:'DaysInInventory',sorttype:'int',width:65,align:'left'}
],
寻呼机:jqgridPagerId,
rowNum:10,
行列表:[5,10,20,50],//页脚中的下拉选择-显示每页的行数。。。
//sortname:'StockDate',
//排序器:“desc”,
sortname:'Vin',
排序器:“desc”,
viewrecords:是的,
//gridview:没错,
imgpath:“”,
描述:“我的库存”,
宽度:1022,
shrinkToFit:错,
身高:200,
sortable:true,/*这允许1)将列横向移动到其他位置字段,2)让jqGrid列选择器插件/JQuery Multiselect插件工作*/
loadonce:true,//在本例中,当“loadonce”设置为true时,使用“colModel”中的“sorttype”属性使其工作。。。
loadError:函数(xhr、st、err){
//警报(“类型:“+st+”;响应:“+xhr.state+”;状态:“+xhr.statusTeext+”;错误:“+err”);
警报(“发生错误,请重试或通知网站管理员此错误”);
}
}).jqGrid('navbuttonad',jqgridPagerId,{
描述:“ddd”,
按钮图标:“ui图标计算器”,
标题:“选择列”,
onclick按钮:函数(){
jqgridSpreadsheetId.jqGrid('columnChooser');
}
});
//导航按钮。。。
/*
$(“#”+jqgridSpreadsheetId).jqGrid('NavButtonAd',“#”+JQGridPageId{
描述:“dd”,
按钮图标:“ui图标计算器”,
标题:“选择列”,
onclick按钮:函数(){
$(this).jqGrid('columnChooser'{
完成:功能(perm){
如果(烫发){
这个.jqGrid(“remapColumns”,perm,true);
saveColumnState.call(this.perm);
}
}
});
}
});
*/
});
navbuttonad
可以在现有导航栏中添加按钮。因此,您必须在之前打电话(请参阅)。比如说
$(“#MyInventoryJqgrid_电子表格”).jqGrid({
url:“../websrvc/JqGrid.ashx”,
数据类型:“json”,
寻呼机:“#MyInventoryJqgrid_寻呼机”,
...