我想在标题的底部添加一个带有不同按钮的工具栏.有什么可能吗?
用过的
toolbar: [true,"top"] or toolbar: [true,"bottom"]
Run Code Online (Sandbox Code Playgroud)
它显示相同的工具栏...在底部工具栏中包含添加,编辑,删除按钮..我想在顶部工具栏中进行更改仅包含ADD按钮..&底部工具栏包含编辑,删除,刷新等,
谢谢,
这是我的代码
$(document).ready(function () {
$('#jqgProducts').jqGrid({
url: '/Home/GridSampleData/', // url from wich data should be requested
datatype: 'json', // type of data
mtype: 'GET', // url access method type
colNames: ['userid', 'username', 'email', 'contact', 'password'],
colModel: [ // columns model
{ name: 'userId', index: 'userId', align: 'left',
editable: false },
{ name: 'username', index: 'username', align: 'left',
editable: true, edittype: 'text',
editoptions: { maxlength: 20 },
editrules: { required: true} },
{ name: 'email', index: 'email', align: 'left', editable: true,
edittype: …Run Code Online (Sandbox Code Playgroud) 看起来jqGrid的默认工具栏始终位于底部.像Next/Prev页面这样的按钮和用于选择每页行数的下拉列表将始终显示在网格的底部.
我找到了一种方法来添加自定义顶部工具栏并将自定义按钮推入其中.
真正需要的是一种将默认功能(如分页)添加到网格顶部而不是底部的方法.
我使用showlink formatter将列作为链接.有什么方法可以在我点击它时调用javascript函数.
现在这是我的代码
$("#list").jqGrid(
{
url: '..',
datatype: 'json', //We specify that the datatype we will be using will be JSON
colNames:['ID', 'User Name'],
colModel :[
{name:'id',index:'id', width:110, sorttype:"string", formatter: 'showlink', formatoptions:{baseLinkUrl:'index.cfm'}},
Run Code Online (Sandbox Code Playgroud)
...
我不想使用baselinkUrl.相反,我可以在点击URL时调用Javascript函数吗?当我使用'showlink'格式化程序时,我的表单数据似乎也没有发布到下一个屏幕.
我正在尝试将按钮添加到新的顶部工具栏.我已经在顶部有一个用于搜索过滤的工具栏,但我想在其上方放置一个新工具栏来添加菜单按钮.
菜单与网格左下角的菜单相同.如果用户将行列表设置为高,则Juse使用户更容易,因此他们不必向下滚动到底部.
最好的方法是什么?欢迎这个例子,我很骄傲.
这是我创建工具栏和按钮的代码.
JS
// Toolbar
$("#customer_grid").jqGrid('filterToolbar', {searchOnEnter: false});
// Bottom left buttons
$("#customer_grid").jqGrid('navButtonAdd',"#customer_grid_pager",{caption:"Add Customer",title:"Add Customer",buttonicon :'ui-icon-plus',
onClickButton:function(){
}
});
$("#customer_grid").jqGrid('navButtonAdd',"#customer_grid_pager",{caption:"Clear",title:"Clear Search",buttonicon :'ui-icon-refresh',
onClickButton:function(){
$("#customer_grid")[0].clearToolbar()
}
});
$("#customer_grid").jqGrid('navButtonAdd',"#customer_grid_pager",{caption:"Close",title:"Close Search",buttonicon :'ui-icon-close',
onClickButton:function(){
}
});
Run Code Online (Sandbox Code Playgroud)
非常感谢
我有3个简单的问题.
我有一些代码告诉我页面中是否存在jqGrid对象:
//Check if there is a jqGrid on the page and if present, reloads its data ;)
var jqGrid = $('div.ui-jqgrid-bdiv table');
if (jqGrid.length) {
//time to reload
$(jqGrid).trigger('reloadGrid');
}
Run Code Online (Sandbox Code Playgroud)
我想找到寻呼机ID元素(如果有的话).有没有办法做到这一点?
假设我的jqGrid表中有一个自定义类:
<table id="myGrid" runat="server" class="customclass"></table>
<div id="myGrid_pager" runat="server"></div>
Run Code Online (Sandbox Code Playgroud)
如何动态检查jqGrid中是否存在customclass?
编辑:
借助Oleg帮助,我能够编写一个reconfigPermissions()显示/隐藏默认添加,编辑和删除按钮的功能.这是功能:
function reconfigPermissions(gridID) {
var enableRegistry = CanModifyRegistry();
var ops = ['#add_' + gridID, '#edit_' + gridID, '#del_' + gridID];
$.each(ops, function (ix, value) {
var $td = $(value);
if (enableRegistry === true) {
$td.show();
} …Run Code Online (Sandbox Code Playgroud) 我想在网格顶部添加三个按钮,用于添加,编辑,删除.并希望为每个操作调用单独的URL.我想为此使用表单编辑.任何人都可以建议我这样的示例代码.
在此先感谢Abhishek