想要只编辑WWID列,同时添加想要添加jqgrid中的所有字段 [英] Want to edit only WWID column and while adding want to add all fields in jqgrid

查看:67
本文介绍了想要只编辑WWID列,同时添加想要添加jqgrid中的所有字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 <   link     rel   = 样式表    type   =  text / css    media   =  screen    href   =  css / ui.jqgrid.css    /  >  
< link rel = stylesheet href = css / jdpicker.css type = text / css / >
< script type = text / javascript src = js / jquery-1.4.2.min.js > < / script >
< script type = text / javascript src = js / jquery.json-2.4.js > < / script >
< script 类型 = text / javascript src = js / grid.locale-en.js > ; < / script >
< script 类型 = text / javascript src = js / jquery.jqGrid.min.js > < / script >



< pre lang =xml> < script <跨度class =code-attribute> type = text / javascript src = js / jquery-ui-1.8.4.custom.min.js > < / script >
< script type = text / javascript src = js / jquery.jdpicker.js > < / scr ipt >



< script type =text /的javascript> 
$(document).ready(function(){

$(#go)。click(function(){
$(#gridId)。GridUnload ();
gridload();
});
});
函数gridload(){
$ .ajax({
url:'Uploading111.aspx / MyMethod?fromdate ='+ $(#fromdate)。val()+'& todate ='+ $(#todate)。val(),
dataType:'json',
contentType:application / json; charset = utf-8,
类型: 'POST',
success:function(ReportDataNew,textStatus,XMLHttpRequest){
// debugger;
gridData = JSON.parse(ReportDataNew.d);
// console。 log(gridData);
//alert(gridData.length);


$(#gridId)。jqGrid({
data:gridData,
数据类型:local,
height:'100%',
//宽度:'2500',

sortable:true,
ignoreCase:true,
hidegrid:true,
// caption:ok,
autowidth:true,
// my forceFit:true ,
rowNum:20,
rowList:[20,50,100,200],
colNames:['UserName','WWID'],
colModel:[
{name:'UserName',index:'UserName',key:true,width:'200',editable:false,sortable:true,align:'center'},
{name:'WWID' ,index:'WWID',width:'250',editable:true,sortable:true,sorttype:'int',align:'center'},],
pager:'#gridpager',
viewrecords:true,
toppager:tr ue,
loadtext:'Loading ...',



});
jQuery(#gridId)。jqGrid('navGrid','#gridpager',
{edit:true,add:true,del:true,search:true,excel:true,exceltext: 'Excel',cloneToTop:true},
{url:Uploading.ashx,closeAfterEdit:true,afterSubmitCell:function(){$('#gridId')。trigger('reloadGrid');}},
{url:Uploading.ashx,closeAfterAdd:true},
{url:Uploading.ashx,closeAfterDel:true},
{closeAfterSearch:true,closeOnEscape:true,multipleSearch :false});
});
}

解决方案

(document).ready(function(){


(#go)。click(function(){


(#gridId)。GridUnload();
gridload();
});
});
函数gridload(){


<link rel="Stylesheet" type="text/css" media="screen" href="css/ui.jqgrid.css" />
      <link rel="stylesheet" href="css/jdpicker.css" type="text/css"/>
     <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
     <script type="text/javascript" src="js/jquery.json-2.4.js"></script>
     <script type="text/javascript" src="js/grid.locale-en.js"></script>
     <script type="text/javascript" src="js/jquery.jqGrid.min.js"></script>


<script type="text/javascript" src="js/jquery-ui-1.8.4.custom.min.js"></script>
      <script type="text/javascript" src="js/jquery.jdpicker.js"></script>


<script type="text/javascript">
            $(document).ready(function () {

                $("#go").click(function () {
                    $("#gridId").GridUnload();
                    gridload();
                });
            });
            function gridload() {
                $.ajax({
                    url: 'Uploading111.aspx/MyMethod?fromdate=' + $("#fromdate").val() + '&todate=' + $("#todate").val(),
                    dataType: 'json',
                    contentType: "application/json; charset=utf-8",
                    type: 'POST',
                    success: function (ReportDataNew, textStatus, XMLHttpRequest) {
                        //debugger;
                        gridData = JSON.parse(ReportDataNew.d);
                        //console.log(gridData);
                        //alert(gridData.length);


                        $("#gridId").jqGrid({
                            data: gridData,
                            datatype: "local",
                            height: '100%',
                         //   width: '2500',
                               
                            sortable:true,
                            ignoreCase:true,
                            hidegrid:true,
                       //   caption:"ok",
                            autowidth: true,
                       //my    forceFit:true,
                            rowNum: 20,
                            rowList: [20, 50, 100, 200],
                            colNames: ['UserName','WWID'],
                            colModel: [
                                { name: 'UserName', index: 'UserName', key: true, width: '200', editable: false,sortable: true, align: 'center' },
                                { name: 'WWID', index: 'WWID', width: '250' , editable: true, sortable: true,sorttype:'int', align: 'center' }, ],
                            pager: '#gridpager',
                            viewrecords: true,
                            toppager: true,
                            loadtext: 'Loading...',

                           
                            
                        });
jQuery("#gridId").jqGrid('navGrid', '#gridpager',
            { edit: true, add: true, del: true, search: true, excel: true, exceltext: 'Excel', cloneToTop: true },
            { url: "Uploading.ashx", closeAfterEdit: true,afterSubmitCell: function () { $('#gridId').trigger('reloadGrid');}},
            { url: "Uploading.ashx", closeAfterAdd: true },
            { url: "Uploading.ashx", closeAfterDel: true },
            { closeAfterSearch: true, closeOnEscape: true, multipleSearch: false });
  });
            }

解决方案

(document).ready(function () {


("#go").click(function () {


("#gridId").GridUnload(); gridload(); }); }); function gridload() {


这篇关于想要只编辑WWID列,同时添加想要添加jqgrid中的所有字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆