View difference between Paste ID: uXPajLph and bXPsTuRB
SHOW: | | - or go back to the newest paste.
1
		$g = new jqgrid();
2
3
		// file upload column
4
		$col = array();
5
		$col["title"] = "Image";
6
		$col["name"] = "news_image";
7
		$col["editable"] = true; 
8
		$col["edittype"] = "file"; // render as file
9
		$col["upload_dir"] = "uploads/news_images"; // upload here
10
		$col["show"] = array("list"=>false,"edit"=>true,"add"=>true); // only show in add/edit dialog
11
		$cols[] = $col;
12
13
14
		$col = array();
15
		$col["title"] = "Image Preview";
16
		$col["name"] = "image";
17-
		$col["formatter"] = "image";
17+
18-
		$col["formatoptions"] = array("class"=>'img_preview'); 
18+
		//$col["formatter"] = "image";
19
		//$col["formatoptions"] = array("class"=>'img_preview'); 
20
		
21
		$col["search"] = false;
22
		$col["show"] = array("list"=>true,"edit"=>true,"add"=>false); // Tried this trick to show Preview in Edit Popup
23
		
24
		$col["condition"] = array('$row["note"] == ""', "None", "<a href='uploads/news_images/{news_image}' target='_blank'><img height=100 src='uploads/news_images/{news_image}'></a>");
25
		$col["editoptions"]["dataInit"] = "function(o){jQuery(o).parent().html(o.value);}";
26
		
27
		$cols[] = $col;