在DataTables中用render参数改变某列的显示内容

如果后台对某个图片传的是url, 在前台怎么直接展示这个图片?

		$('#example').DataTable({
	        "processing": true,
	        "serverSide": true,	        
	         "ajax": {
	                "url": "/someRestful",
	                "type": "POST"
	         },	      
         
	         "columns": [
	                    ...
	                     { "data": "imageUrl", 
	                    	"render":	function ( data, type, full, meta ) {
	                    	      return data == null? '': '<img  src="' + data + '"/>';
	                        } 
	                     },
	                     ...          
	                 ]	         
		});

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.