Javascript Jqgrid自定义edittype自定义元素事件未触发 函数myelem(值、选项){ 警报(“1”); var el=document.createElement(“输入”); el.type=“无线电”; 如果(值=“0”) el.checked=false; 其他的 e1.checked=true; 返回el; } 函数myvalue(元素、操作、值){ 如果(操作=='get'){ 返回$(elem).find(“输入”).val(); }else if(操作=='set'){ $('input',elem).val(值); } } 函数FailGrdTranHistory(){ 警报('函数执行失败…'); } 函数successSubGridFunction(jsondata){ HideCommentHeader(); var thegrid=jQuery(“#”+子网格表名)[0]; var jdata=jsondata.d;//.split(“~”); addJSONData(JSON.parse(jdata)); 解锁页面(); } jQuery(文档).ready(函数(){ jQuery(“#jqGrid1”).jqGrid({ 数据类型:“本地”, 身高:250, colNames:['Inv No','From','Date','Client','Amount','Tax','Total','Notes'], colModel:[ {name:'id',index:'id',width:60,sorttype:'int'}, {name:'from',width:60,edittype:'custom',editoptions:{custom_元素:myelem,custom_值:myvalue}}, {name:'invdate',index:'invdate',宽度:90,排序类型:“date”}, {name:'name',index:'name',宽度:100}, {name:'amount',index:'amount',width:80,align:“right”,sorttype:“float”}, {name:'tax',index:'tax',宽度:80,对齐:“right”,排序类型:“float”}, {名称:'total',索引:'total',宽度:80,对齐:“right”,排序类型:“float”}, {name:'note',index:'note',宽度:150,可排序:false} ], 寻呼机:“#寻呼机”, rowNum:10, 行列表:[10,20,30], sortname:'id', 排序器:“desc”, viewrecords:是的, imgpath:“lib/basic/images”, 标题:“操纵数组数据” }); var mydata=[ {id:“1”,起自:“0”,投资日期:“2007-10-01”,名称:“测试”,注:“注”,金额:“200.00”,税款:“10.00”,总额:“210.00”}, {id:“2”,起自:“1”,投资日期:“2007-10-02”,名称:“test2”,注:“注2”,金额:“300.00”,税款:“20.00”,总额:“320.00”}, {id:“3”,起自:“0”,投资日期:“2007-09-01”,名称:“test3”,注:“注3”,金额:“400.00”,税款:“30.00”,总计:“430.00”}, {id:“4”,起自:“1”,投资日期:“2007-10-04”,名称:“测试”,注:“注”,金额:“200.00”,税款:“10.00”,总额:“210.00”}, {id:“5”,起自:“1”,投资日期:“2007-10-05”,名称:“test2”,注:“注2”,金额:“300.00”,税款:“20.00”,总计:“320.00”}, {id:“6”,起自:“1”,投资日期:“2007-09-06”,名称:“test3”,注:“注3”,金额:“400.00”,税款:“30.00”,总计:“430.00”}, {id:“7”,起自:“1”,投资日期:“2007-10-04”,名称:“测试”,注:“注”,金额:“200.00”,税款:“10.00”,总额:“210.00”}, {id:“8”,起自:“1”,投资日期:“2007-10-03”,名称:“test2”,注:“注2”,金额:“300.00”,税款:“20.00”,总计:“320.00”}, {id:“9”,起自:“0”,投资日期:“2007-09-01”,名称:“test3”,注:“注3”,金额:“400.00”,税款:“30.00”,总计:“430.00”} ]; 对于(var i=0;i

Javascript Jqgrid自定义edittype自定义元素事件未触发 函数myelem(值、选项){ 警报(“1”); var el=document.createElement(“输入”); el.type=“无线电”; 如果(值=“0”) el.checked=false; 其他的 e1.checked=true; 返回el; } 函数myvalue(元素、操作、值){ 如果(操作=='get'){ 返回$(elem).find(“输入”).val(); }else if(操作=='set'){ $('input',elem).val(值); } } 函数FailGrdTranHistory(){ 警报('函数执行失败…'); } 函数successSubGridFunction(jsondata){ HideCommentHeader(); var thegrid=jQuery(“#”+子网格表名)[0]; var jdata=jsondata.d;//.split(“~”); addJSONData(JSON.parse(jdata)); 解锁页面(); } jQuery(文档).ready(函数(){ jQuery(“#jqGrid1”).jqGrid({ 数据类型:“本地”, 身高:250, colNames:['Inv No','From','Date','Client','Amount','Tax','Total','Notes'], colModel:[ {name:'id',index:'id',width:60,sorttype:'int'}, {name:'from',width:60,edittype:'custom',editoptions:{custom_元素:myelem,custom_值:myvalue}}, {name:'invdate',index:'invdate',宽度:90,排序类型:“date”}, {name:'name',index:'name',宽度:100}, {name:'amount',index:'amount',width:80,align:“right”,sorttype:“float”}, {name:'tax',index:'tax',宽度:80,对齐:“right”,排序类型:“float”}, {名称:'total',索引:'total',宽度:80,对齐:“right”,排序类型:“float”}, {name:'note',index:'note',宽度:150,可排序:false} ], 寻呼机:“#寻呼机”, rowNum:10, 行列表:[10,20,30], sortname:'id', 排序器:“desc”, viewrecords:是的, imgpath:“lib/basic/images”, 标题:“操纵数组数据” }); var mydata=[ {id:“1”,起自:“0”,投资日期:“2007-10-01”,名称:“测试”,注:“注”,金额:“200.00”,税款:“10.00”,总额:“210.00”}, {id:“2”,起自:“1”,投资日期:“2007-10-02”,名称:“test2”,注:“注2”,金额:“300.00”,税款:“20.00”,总额:“320.00”}, {id:“3”,起自:“0”,投资日期:“2007-09-01”,名称:“test3”,注:“注3”,金额:“400.00”,税款:“30.00”,总计:“430.00”}, {id:“4”,起自:“1”,投资日期:“2007-10-04”,名称:“测试”,注:“注”,金额:“200.00”,税款:“10.00”,总额:“210.00”}, {id:“5”,起自:“1”,投资日期:“2007-10-05”,名称:“test2”,注:“注2”,金额:“300.00”,税款:“20.00”,总计:“320.00”}, {id:“6”,起自:“1”,投资日期:“2007-09-06”,名称:“test3”,注:“注3”,金额:“400.00”,税款:“30.00”,总计:“430.00”}, {id:“7”,起自:“1”,投资日期:“2007-10-04”,名称:“测试”,注:“注”,金额:“200.00”,税款:“10.00”,总额:“210.00”}, {id:“8”,起自:“1”,投资日期:“2007-10-03”,名称:“test2”,注:“注2”,金额:“300.00”,税款:“20.00”,总计:“320.00”}, {id:“9”,起自:“0”,投资日期:“2007-09-01”,名称:“test3”,注:“注3”,金额:“400.00”,税款:“30.00”,总计:“430.00”} ]; 对于(var i=0;i,javascript,jquery,jqgrid,Javascript,Jquery,Jqgrid,,为了不让问题看起来没有答案,我添加了我的解决方案。对于该列,我使用了以下代码: <script src="jquery-1.8.0.min.js" type="text/javascript"></script> <script src="grid.locale-en.js" type="text/javascript"></script> <script src="jquery.jqGrid.min.js" type="t

,为了不让问题看起来没有答案,我添加了我的解决方案。对于该列,我使用了以下代码:

<script src="jquery-1.8.0.min.js" type="text/javascript"></script>
    <script src="grid.locale-en.js" type="text/javascript"></script>
    <script src="jquery.jqGrid.min.js" type="text/javascript"></script>
   <script type="text/javascript">    
    function myelem(value, options) {
            alert('1'); 
            var el = document.createElement("input");
            el.type = "radio";
            if (value == "0")
                el.checked = false;
            else
                e1.checked = true;
            return el;
        }

        function myvalue(elem, operation, value) {
            if(operation === 'get') {
               return $(elem).find("input").val();
            } else if(operation === 'set') {
               $('input',elem).val(value);
            }
       }

       function FailGrdTranHistory() {
           alert('Function Execution Failed...');
       }
       function successSubGridFunction(jsondata) {
           HideCommentHeader();
           var thegrid = jQuery("#" + SubGridTableName)[0];
           var jdata = jsondata.d; //.split("~");
           thegrid.addJSONData(JSON.parse(jdata));
           unblockPage();
       }

        jQuery(document).ready(function () {
            jQuery("#jqGrid1").jqGrid({
                datatype: "local",
                height: 250,
                colNames: ['Inv No', 'From','Date', 'Client', 'Amount', 'Tax', 'Total', 'Notes'],
                colModel: [
                    { name: 'id', index: 'id', width: 60, sorttype: "int" },
                    {name: 'from',width:60,editable: true,edittype: 'custom',editoptions: {custom_element: myelem, custom_value:myvalue}},
                    { name: 'invdate', index: 'invdate', width: 90, sorttype: "date" },
                    { name: 'name', index: 'name', width: 100 },
                    { name: 'amount', index: 'amount', width: 80, align: "right", sorttype: "float" },
                    { name: 'tax', index: 'tax', width: 80, align: "right", sorttype: "float" },
                    { name: 'total', index: 'total', width: 80, align: "right", sorttype: "float" },
                    { name: 'note', index: 'note', width: 150, sortable: false }
                ],
                pager: '#pager',
                rowNum: 10,
                rowList: [10, 20, 30],
                sortname: 'id',
                sortorder: 'desc',
                viewrecords: true,
                imgpath: "lib/basic/images",
                caption: "Manipulating Array Data"
            });

        var mydata = [
            { id: "1",from: "0" , invdate: "2007-10-01", name: "test", note: "note", amount: "200.00", tax: "10.00", total: "210.00" },
            { id: "2",from: "1", invdate: "2007-10-02", name: "test2", note: "note2", amount: "300.00", tax: "20.00", total: "320.00" },
            { id: "3",from: "0", invdate: "2007-09-01", name: "test3", note: "note3", amount: "400.00", tax: "30.00", total: "430.00" },
            { id: "4",from: "1", invdate: "2007-10-04", name: "test", note: "note", amount: "200.00", tax: "10.00", total: "210.00" },
            { id: "5",from: "1", invdate: "2007-10-05", name: "test2", note: "note2", amount: "300.00", tax: "20.00", total: "320.00" },
            { id: "6",from: "1", invdate: "2007-09-06", name: "test3", note: "note3", amount: "400.00", tax: "30.00", total: "430.00" },
            { id: "7",from: "1", invdate: "2007-10-04", name: "test", note: "note", amount: "200.00", tax: "10.00", total: "210.00" },
            { id: "8",from: "1", invdate: "2007-10-03", name: "test2", note: "note2", amount: "300.00", tax: "20.00", total: "320.00" },
            { id: "9",from: "0", invdate: "2007-09-01", name: "test3", note: "note3", amount: "400.00", tax: "30.00", total: "430.00" }
        ];
        for (var i = 0; i <= mydata.length; i++) {
                jQuery("#jqGrid1").jqGrid('addRowData', i + 1, mydata[i]);
            }
        });
     </script>
{
名称:'测试',
索引:'测试',
宽度:“63px”,
可排序:false,
edittype:'自定义',
格式化程序:函数(cellvalue、options、rowObject){
返回“”
}
}

您使用的是哪种编辑机制(您没有在发布的代码中启用任何类型的编辑)?我没有设置任何编辑模式,这是问题的原因。因此,我对该列使用了以下代码{name:'Test',index:'Test',width:'63px',sortable:false,edittype:'custom',formatter:function(cellvalue,options,rowObject){return'},
{
    name: 'Test',
    index: 'Test',
    width: '63px',
    sortable: false,
    edittype: 'custom',
    formatter: function (cellvalue, options, rowObject) {
        return '<input type="radio" name="selectedCall" value="' + cellvalue + '"' + '/>'
    }
}