Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dgrid version 1.3.3 is breaking formatter function in dgrid #1477

Closed
pnaqati opened this issue Sep 17, 2020 · 2 comments
Closed

dgrid version 1.3.3 is breaking formatter function in dgrid #1477

pnaqati opened this issue Sep 17, 2020 · 2 comments

Comments

@pnaqati
Copy link

pnaqati commented Sep 17, 2020

columns:{
col1: { selector: 'checkbox', label:''} ,
id: { hidden :true ,unhidable: true},
content:{label:'Photo',field:"_item",
formatter: function(item){
if(!item){
return;
}else
{

							 return "<div id=\"productImageDiv\"><img src=\"/getProductImage/" + item.id +','+1+ "\"  width=\"100%\" height=\"100%\" style=\"vertical-align: middle\" alt="+ item.typeName +" /> </div> ";                                                     
                    	}
                    	}                       
                },
			    description: {label:'Description', field:"description",formatter: function (value) {				    	
		             return '<div id="shopProductDescription">'+value+'</div>'; 
		        }} , 
		        sdescription: {label:'Description', field:"sdescription",formatter: function (value) {				    	
		             return '<div id="shopsProductDescription">'+value+'</div>'; 
		        }} , 			        
		        companyname: { label: 'Supplier',id: 'companyid',renderCell: contactSupplier}, 
				discount : {label:'Discount', field:"discount",formatter: function (value) { 
                	 var num=number.format(value, {places:0});
                	 if (num > 0 )
		             return '<div id="discountCurrency">'+num+'%<span>&nbsp;</span> </div>';
                	 else
                     return '<div id="discountCurrency"> </div>';	 
		        }} ,
		        cost : {label:'Price (CAD)', field:"cost",formatter: function (value) { 
                	 var num=number.format(value, {places:2,pattern:'########.##'});	
		             return '<div id="productCurrency">$<span>&nbsp;</span>'+num+'</div>';
		        }} ,

Capture
Capture

@pnaqati
Copy link
Author

pnaqati commented Sep 19, 2020

I changed formatter with renderCell function and this issue is resolved

@pnaqati pnaqati closed this as completed Sep 19, 2020
@msssk
Copy link
Contributor

msssk commented Sep 21, 2020

This is a documented breaking change in 1.3.0 aimed at making dgrid more secure by default and reducing the chance of accidental XSS. formatter can still be used with HTML strings by providing an object with an html property (see documentation).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants