开发者

jqgrid encode format

This is my jqgrid :

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
);

}); 

i have save this string with jqgrid :

      开发者_运维问答  `Sweet Dreams ☆:*´¨`*:☆` 

but in the database i have this string :

        `Sweet Dreams ☆:*´¨`*:☆`

The data it's correctly displayed in jqgrid , but if i try to get this data with query and to display in an html page i look encoded string.which type of encode use jqgrid?


Version 3.5.2 of jqGrid included an important new feature:

Now when autoencode is set to true by default and this encode the data coming from server and not only when we post it (secutity fix).

You can override this when you don’t want encoded data by setting autoencode false when setting up your grid:

            $("#grid").jqGrid({
                    autoencode: false,
                    url: "/Some/Path",
                    // etc....,});

See the following url for further info,

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

Hope this helps..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜