PDA

View Full Version : Different text between textfield and textarea editor in Grid panel



supertotal
20 Oct 2013, 8:40 AM
Hi everybody,

I use Extjs 4 and I create a grid panel with text field and textarea editor than appears when I clic on the text field.
I 've added a renderer to my text field in order to replace string, it works fine.

My problem is :
the data is different between textfield and textarea editor. The textarea displays the original code (before the renderer replace string).

My question are :
- How can I do for get the value of text field (after replace) and put it in the textarea editor ?
- Could I add the same renderer than textfield in the textarea editor (I try this solution without success) ?

Here a snippet of my source code (the red code does nothing) :

{
text : 'My Field',
width : 50,
sortable : true,
renderer:function(str){
return str.replace(/\|/g, '\n');
},
dataIndex: 'myData',
editor: { xtype: 'textarea', height: 100,renderer:function(str){
return str.replace(/\|/g, '\n');
}, }
}


Thanks for your answer.

ettavolt
21 Oct 2013, 1:33 AM
You cannot do this either way.
Instead, you may either store values with \n or specify some custom valueToRaw and rawToValue function for your textarea instance.