相关疑难解决方法(0)

jqgrid - 设置edittype的custom_value:'custom'

place_id的custom_value设置为我先点击的任何一行.无论实际值如何,后续单击的行都将使用相同的值.为什么?

例:

place_id foo_name bar_value
   10      blah       abc
   11      blah2      fgr
Run Code Online (Sandbox Code Playgroud)

单击place_id为10的行,然后单击"编辑",出现的表单将包含10place_id值.进行更改并保存,然后单击下一行.10虽然所有其他值都是正确的,但表单仍将具有place_id .

我的代码:

列place_id如下所示:

{name:'place_id', index:'place_id', editable: true, edittype:'custom',
 editoptions: { custom_element:myelem,custom_value:myval }}
Run Code Online (Sandbox Code Playgroud)

myval功能是:

function myval(elem){
    return elem.val();
}
Run Code Online (Sandbox Code Playgroud)

我需要的是将myval设置为正在编辑的行的正确place_id.我看着elemFirebug 中的对象,我发现它总是具有第一次点击的行的值,但我不明白为什么我也不知道从哪里可以获取正确的值.任何建议都表示赞赏(我试过在jqgrid论坛上询问,但没有任何结果,所以我转向stackoverflow).

*编辑:如果我使用edittype:'text'而不是edittype:'custom'我得到显示和传递的正确值,但该列是可编辑的,它应该只是可见但不可编辑.

完整代码:

jQuery(document).ready(function(){ 
    jQuery("#list").jqGrid({
        url:'/foo/bar/results',
        datatype: 'json',
        mtype: 'POST',
        colNames:['Place ID', 'Site ID', 'Site Name', 'API ID', 'M Type'],
        colModel :[ 
            {name:'place_id', index:'place_id', key: true, sorttype:'integer',
             width:70, editable: true, edittype:'custom',
             editoptions: {custom_element:myelem,custom_value:myval }},
            {name:'site_id', index:'site_id', sorttype:'integer', …
Run Code Online (Sandbox Code Playgroud)

javascript jquery jqgrid

4
推荐指数
1
解决办法
2万
查看次数

使用loadonce重新加载jqgrid:true

我是使用jqgrid的新手.

在新页面加载时,网格正在从数据库中正确加载数据.之后由于loadonce:true,网格没有从数据库重新加载数据以进行添加/编辑/删除.

我的应用程序组合是JSP,Servlet,MySQL

我有一个具有以下设置的网格

jQuery("#userList").jqGrid({
                    url: '<%=request.getContextPath()%>/userJqGrid?q=1&action=fetchData&userCookie=<%= encodedCookie%>',
                    datatype: 'xml',
                    mtype: 'GET',
                    colNames:['<%= userProp.getProperty(userColNames[0])%>',
                              '<%= userProp.getProperty(userColNames[1])%>',
                              '<%= userProp.getProperty(userColNames[2])%>',
                              '<%= userProp.getProperty(userColNames[3])%>',
                              '<%= userProp.getProperty(userColNames[4])%>',
                              '<%= userProp.getProperty(userColNames[5])%>'
],
                    colModel:[
                        {name:'<%= userColNames[0]%>',index:'<%= userColNames[0]%>',
                            width:120,sortable:true,editable:true,editrules:{required:true},formoptions:{rowpos:1, elmprefix:'*'}},
                        {name:'<%= userColNames[1]%>',index:'<%= userColNames[1]%>',
                            width:130,sortable:true,editable:true},
                        {name:'<%= userColNames[2]%>',index:'<%= userColNames[2]%>',
                            width:100,sortable:true,editable:true,editrules:{required:true},formoptions:{rowpos:3, elmprefix:'*'}},
                        {name:'<%= userColNames[3]%>',index:'<%= userColNames[3]%>',
                            width:180,sortable:true,editable:true,editrules:{email:true,required:true},formoptions:{rowpos:4, elmprefix:'*'}},
                        {name:'<%= userColNames[4]%>',index:'<%= userColNames[4]%>', 
                            width:100,sortable:true,editable:true},
                        {name:'<%= userColNames[5]%>',index:'<%= userColNames[5]%>', 
                            width:100,sortable:true,editable:true},
                    ],
                    pager: '#pager1',
                    rowNum:50,
                    height:'auto',
                    //rowList:[10,20,30],
                    loadonce: true,
                    sortname:'<%= userColNames[0]%>',
                    viewrecords: true,
                    editurl:'<%=request.getContextPath()%>/userJqGrid?q=1&action=addData&userCookie=<%= encodedCookie%>',
                    caption: 'User Grid',
                    ondblClickRow: function(rowid) {
                       $("#userList").jqGrid('editGridRow',rowid, userEditParam);
                        return;
                    }
                 });
$("#userList").jqGrid('navGrid',"#pager1",{add:true,edit:true,del:true});
$("#userList").jqGrid('gridResize', …
Run Code Online (Sandbox Code Playgroud)

jquery jqgrid

3
推荐指数
1
解决办法
1万
查看次数

jqGrid navigator - 如何在全球范围内进行specyfy设置?

我正在使用NavigatorjqGrid,我重复一遍又一遍的设置,例如:

savekey: [true, 13],
closeOnEscape: true,
closeAfterAdd: true
Run Code Online (Sandbox Code Playgroud)

如何在当前页面上为我的所有网格全局定义这些设置?

我知道如何在全局范围内进行jqGrid设置,但是我遇到Navigator问题.我的示例Navigator定义如下所示:

    $("#dictionaryElementsGrid").navGrid(
        "#dictionaryElementsPager",
        {
            search: false,
            edit: true,
            add: true,
            del: true
        },
        {
            // Edit options:
            savekey: [true, 13],
            closeOnEscape: true,
            closeAfterEdit: true
        },
        {
            // Create options:
            savekey: [true, 13],
            closeOnEscape: true,
            closeAfterAdd: true
        }
    );
Run Code Online (Sandbox Code Playgroud)

jqgrid navigator

1
推荐指数
1
解决办法
3761
查看次数

标签 统计

jqgrid ×3

jquery ×2

javascript ×1

navigator ×1