Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Next revision Both sides next revision | ||
wiki:custom_formatter [2010/06/03 14:17] manu |
wiki:custom_formatter [2011/09/17 13:49] artemeey |
||
---|---|---|---|
Line 59: | Line 59: | ||
... | ... | ||
}); | }); | ||
- | function myunformatfunc ( cellvalue, options, cellobject) | + | |
- | { | + | |
- | // do something here | + | Image: |
- | return unformated_value; | + | |
- | } | + | <code javascript> |
+ | <script> | ||
+ | jQuery("#grid_id").jqGrid({ | ||
+ | ... | ||
+ | colModel: [ | ||
+ | ... | ||
+ | {name:'price', index:'price', width:60, align:"center", editable: true, formatter:imageFormat, unformat:imageUnFormat}, | ||
+ | ... | ||
+ | ] | ||
+ | ... | ||
+ | }); | ||
+ | |||
+ | function imageFormat( cellvalue, options, rowObject ){ | ||
+ | return '<img src="'+cellvalue+'" />'; | ||
+ | } | ||
+ | function imageUnFormat( cellvalue, options, cell){ | ||
+ | return $('img', cell).attr('src'); | ||
+ | } | ||
</script> | </script> | ||
</code> | </code> |