Ceci est mon jqGrid:jqGrid format encode
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
);
});
j'ai enregistrer cette chaîne avec jqGrid:
`Sweet Dreams ☆:*´¨`*:☆`
mais dans la base de données i cette chaîne:
`Sweet Dreams ☆:*´¨`*:☆`
Le données, il est correctement affiché dans jqgrid, mais si j'essaie d'obtenir ces données avec requête et d'afficher dans une page html je regarde codé chaîne.quelque type de encoder utiliser jqgrid?
ok mais w Quel type d'encodage utilise jqgrid? – magemello
Je ne suis pas sûr de l'encodage (pour empêcher les attaques xss), mais la documentation de jqgrid dit à propos de certaines chaînes codées en HTML. Vérifiez l'option "jgrid.htmlDecode" de l'URL suivante. http://www.trirand.com/jqgridwiki/doku.php?id=wiki%3amethods – Harun