PDA

View Full Version : [DUP] Custom property weird truncation



pharix
9 Mar 2012, 9:31 PM
When setting a custom property on any component (i.e.: Store), if a line is longer than width of free-form textfield, it will truncate / strip out white spaces.

Example scenario:

1. Create a Store.

2. Add custom property "grouper".

3. Add the following into the value of grouper:

{
groupFn: function(record) {
return record.get('last_name').substr(0, 1);
},
sortProperty: 'last_name'
}


4. Generated code becomes:


grouper: {
groupFn: function(record){
returnrecord.get('last_name').substr(0,
1);
},
sortProperty: 'last_name'
},


Also ... is there a nicer way to put in custom properties into components? The textbox is really tiny, and doesn't always treat the text I put into the box as "code", and instead it tries to convert it into a String:

This:


custom_value = { something: this.someMethod('xx') }


Becomes:


custom_value: '{\nsomething: this.someMethod(\'xx\')\n}'


It's my first post, so I apologize if I'm not posting it right. Let me know if I should be posting both of the above issues separately or if I should be posting differently and I'll learn quick!

bharatn
10 Mar 2012, 6:21 PM
Hi,

You can add grouper from toolbox to the store and configure the groupFn config for the grouper.
So you dont need a custom property.

You bring up a good point of having better editor for custom properties and we will look into it.

I will create a bug so that formatting for the function is handled correctly.

Regarding "custom_value = { something: this.someMethod('xx') }"
ensure this.someMethod can be resolved else it will be converted to string.

Thanks

pharix
10 Mar 2012, 8:35 PM
Thanks for the guidance, bharatn!

You guys did a great job at improving Designer and adding so many new things that I completely missed it. Thanks for pointing me to it.

WRT:

custom_value = { something: this.someMethod('xx') }

... would it be at all possible to not have that "intelligence" and instead allow the developer to choose explicitly that they want something to be a string?

Just a thought.

Good job on the Designer so far.