View Full Version : [CLOSED] Component Column Renderer from CodeBehind In mvc

Nov 25, 2014, 2:39 PM
How to set Renderer for component column from code behind.i use http://mvc.ext.net/#/GridPanel_ArrayGrid/DirectEvent_Creation/ and just change column Price as component column and try

Renderer = { Handler = "Ext.util.Format.indianMoney" },

Ext.util.Format.indianMoney = function (v) {

v = String(v).replace(/[^0-9.\-]/g, "");
v = (Math.round((v - 0) * 100)) / 100;
v = (v == Math.floor(v)) ? v + ".00" : ((v * 10 == Math.floor(v * 10)) ? v + "0" : v);
v = String(v);

var ps = v.split('.'),
whole = ps[0],
sub = ps[1] ? '.' + ps[1] : '.00',
r = /(\d+)(\d{3})/;

// while (r.test(whole)) {

// whole = whole.replace(r, '$1' + ',' + '$2');
// }

return "₹ "+ whole + sub ;

but not working ,please help.

Nov 26, 2014, 5:18 AM
Hi @matrixwebtech,

A ComponentColumn's doesn't support a custom Renderer. Internally, it uses its own Renderer function to actually render its Component.

You can use your format function for a regular Column.

new Column
Renderer =
Handler = "return Ext.util.Format.indianMoney(value);"

Nov 26, 2014, 5:33 AM
For regular columns its fine ,I am facing no problem with custom column Renderer.so,Component Column's custom Renderer is not possible?

Nov 26, 2014, 5:53 AM
so,Component Column's custom Renderer is not possible?

Yes, it is not possible. In the case with a ComponentColumn you should deal with its Component only.

Nov 26, 2014, 6:12 AM
I put a TextField inside component column .can I set a Renderer for the TextField

Nov 26, 2014, 12:03 PM
Unfortunately, there is no such the functionality.

Searching the forums you might find some attempts to achieve similar things.

Nov 27, 2014, 2:11 AM
hi daniil
thanks for the information.this thread can be close.and one more thing,how you search on forum,your provided links are exact ,can you please let me know the technique.

Nov 27, 2014, 4:47 AM
and one more thing,how you search on forum,your provided links are exact ,can you please let me know the technique.

Usually I start to search via "Tag" here.

For example, try to type "grid". A dropdown list appears with possible options. Pick one and search. Please note that the forum members associate tags to threads. So, there might be anything.

If nothing, I search via "Keyword(s)" in Titles, then in Posts.

If nothing, I try to search via a regular Google. You can see the search box at any forum page.

Sometimes I change the sequence of search options (that I described above). It depends on what I am looking for. It is hard to explain why I prefer one or another from time to time:)

Also, probably the most important thing is keywords. What you type to search.