Victor
Victor

Reputation: 17087

Renderer in ext-js

What is (in summary) the function of the renderer in ext js?

Upvotes: 0

Views: 664

Answers (3)

Chirag Parmar
Chirag Parmar

Reputation: 11

Renderes transforms the value of display field into custom fashion. let say i want to display any prize value into dollar

{ xtype:'displayfield',   
  name:'name',   
  value:'45',   
  renderer:this.transformIntoDollarConvention 
}

here, transformIntoDollarConvention is a function defind above the constructor with a return statemnt .

transformIntoDollarConvention:function(value)
{
return value+'$';
}

Upvotes: 0

Gerrat
Gerrat

Reputation: 29680

A renderer is basically the function responsible for showing the underlying data to the user in a fashion or format that looks nice or makes sense.

Some examples might make it more clear:

A date renderer could take a javascript Date object and format it nicely like:

January 27, 2011

A number renderer could take a number like 2.23535346 and format it to 2 decimals like:

2.26

A renderer could even take a string like 'Y' or 'N' and instead show it as an image like:

Yes

Basically, the sky is the limit.

Upvotes: 3

Ruan Mendes
Ruan Mendes

Reputation: 92274

The renderer allows you to format data from a store in any way you see fit. It's a function that takes an data value and can return HTML. This is used to keep code that generates HTML separate from the code that generates the data.

Upvotes: 0

Related Questions