首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >jqgrid编码格式

jqgrid编码格式
EN

Stack Overflow用户
提问于 2011-07-05 18:44:33
回答 1查看 7K关注 0票数 1

这是我的jqgrid:

代码语言:javascript
复制
jQuery(document).ready(function(){ 
  jQuery("#list").jqGrid({  
  url:'getmessage.asp?query=1&col_empty=3&rand_no'+Math.random(),
  datatype: "json", 
  colNames:['ID','Title','Username','Commento', 'mail', 'Data','Conferma email','Moderato','Stato','Option'],
  colModel:[ 
  {name:'1',index:'1', width:80,sortable:false}, 
  {name:'2',index:'2', width:80,editable:false,editoptions:{readonly:false,size:20},editrules:{required:true}}, 
  {name:'3',index:'3', width:80,editable:true,editoptions:{readonly:false,size:20},editrules:{required:true}}, 
  {name:'4',index:'4', width:200,editable:true,edittype:"textarea", editoptions:{rows:"4",cols:"20"},editoptions:{readonly:false,size:20},editrules:{required:true}}, 
  {name:'5',index:'5', width:120, editable:true,editoptions:{readonly:false,size:20},editrules:{required:true}}, 
  {name:'6',index:'6',width:80,  sorttype:"datetime",formatter:"date",formatoptions:{"srcformat":"d/m/Y","newformat":"d/m/Y"},editoptions:{"dataInit":function(elm){setTimeout(function(){

                    jQuery(elm).datepicker({dateFormat:'dd/mm/yy'});

                    jQuery('.ui-datepicker').css({'font-size':'100%'});

                },200);}},editable:true}, 
  {name:'7',index:'7', width:80, sortable:true,editable:true,edittype:"select", editoptions:{value:"1:1;0:0"}} ,
  {name:'8',index:'8', width:80,sortable:true,editable:true,edittype:"select", editoptions:{value:"1:1;0:0"}} ,
  {name:'stato',index:'stato',width:90,sortable:false,editable:false}  ,
  {name:'act',index:'act', width:100,sortable:false,editable:false}  ],
pager: jQuery('#pcrud'),
rowNum:10, 
rowTotal: 50,
rowList:[10,20,30], 
height: '100%',
pager: '#pcrud', 
cellEdit: false,
sortname: '1', 
loadonce: false, 
editurl: 'server.asp?query=1', // this is dummy existing url
viewrecords: true, 
sortorder: "asc",
cellsubmit:'clientArray',
reloadAfterSubmit:true,
gridComplete: function(){ 

        var ids = jQuery("#list").jqGrid('getDataIDs'); 


            for(var i=0;i < ids.length;i++){ 
                var cl = ids[i];
                if (jQuery('#list').getCell(ids[i], '6') == '1' && jQuery('#list').getCell(ids[i], '7') == '1')
                    {
                      jQuery("#list").jqGrid('setRowData',ids[i],{stato:"<font color='#3DB64E'>Approved</font>"});  
                    }
                    else
                    {
                    jQuery("#list").jqGrid('setRowData',ids[i],{stato:"<font color='#FF2323'>Unapproved</font>"}); 
                    }
                be = "<img src='/images/delete_msg.png' style='height:28px;width:28px;'  alt='Delete' onclick=\"deleteComment('"+cl+"');\"  />"; 
                se = "<img src='/images/unapprove_msg.png' style='height:28px;width:28px;' alt='Suspend' onclick=\"unApproveComment('"+cl+"');\" />"; 
                ce = "<img src='/images/approve_msg.png' style='height:28px;width:28px;' alt='Approve' onclick=\"approveComment('"+cl+"');\" />"; 
                jQuery("#list").jqGrid('setRowData',ids[i],{act:be+se+ce}); } 

        },
caption:"Comment"}); 
jQuery("#list").jqGrid('navGrid','#pcrud',
{}, //options
{reloadAfterSubmit:true}, // edit options
{reloadAfterSubmit:true}, // add options
{reloadAfterSubmit:false}, // del options
{} // search options
);

}); 

我用jqgrid保存了这个字符串:

代码语言:javascript
复制
        `Sweet Dreams ☆:*´¨`*:☆` 

但是在数据库中,我有一个字符串:

代码语言:javascript
复制
        `Sweet Dreams ☆:*´¨`*:☆`

它正确地显示在jqgrid中的数据,但是如果我试图通过查询获取这些数据并在html页面中显示,我看上去编码的string.which类型的编码使用jqgrid?

EN

回答 1

Stack Overflow用户

发布于 2011-07-05 19:04:33

jqGrid的3.5.2版包含了一个重要的新特性:

现在,当自动编码默认设置为true时,对来自服务器的数据进行编码,而不仅仅是在我们发布它时(安全修复)。

在设置网格时,可以重写此,当您不希望通过设置自动编码假来编码数据时:

代码语言:javascript
复制
            $("#grid").jqGrid({
                    autoencode: false,
                    url: "/Some/Path",
                    // etc....,});

有关更多信息,请参见下面的url

http://blogs.teamb.com/craigstuntz/2010/02/08/38548/

希望这有帮助..。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6587357

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档