PDA

View Full Version : [CLOSED] How to custom attributes get set ?



siyahgul
Feb 19, 2015, 7:17 PM
<ext:Panel ID="Panel1" runat="server" myprop="deneme">
<Items>
<ext:TextField ID="TextField1" runat="server" FieldLabel="asdsadsad">
</ext:TextField>
</Items>
</ext:Panel>


TextField1 add myprop (attr) ?
Panel1 get and set myprop value ?

geoffrey.mcgill
Feb 19, 2015, 7:38 PM
In your sample I don't see where you are trying to get or set a property?

Are you doing this client-side or server-side?

siyahgul
Feb 19, 2015, 7:40 PM
client side extjs

geoffrey.mcgill
Feb 19, 2015, 7:53 PM
client side extjs

Excellent.

Have you reviewed the client-side documentation?

http://docs.sencha.com/extjs/5.0/5.0.0-apidocs/

What methods have you already attempted?

If you put together a sample demonstrating the whole scenario, we should be able to provide some assistance.

siyahgul
Feb 19, 2015, 8:04 PM
I can't give you anymore scenario. :)

just, How do I set and get the value from custom attr ?



Ex: App.Panel1.getEl('myprop') ;

siyahgul
Feb 19, 2015, 8:10 PM
I don't know where to look. Do I have to read them all?

geoffrey.mcgill
Feb 19, 2015, 8:11 PM
So, if you console.log the component in FireBug, what does that return? Can you see your custom property and value?

siyahgul
Feb 19, 2015, 8:23 PM
<ext:PanelID="Panel1" runat="server" myprop="deneme">
<Items>
<ext:TextField ID="TextField1" runat="server" FieldLabel="asdsadsad">
</ext:TextField>
</Items>
</ext:Panel>




Ext.onReady(function () {
try {
App.Panel1.getAttribute('myprop');
} catch (e) {
alert(e);
}
}


type error: undefined is not a funtion

siyahgul
Feb 19, 2015, 8:48 PM
Ext.onReady(function () {
try {
//alert(Object.keys(App.Panel1));

alert(App.Panel1.myprop); // return deneme
App.Panel1.myprop = 'test';
alert(App.Panel1.myprop); // return test
} catch (e) {
alert('err: ' + e);
}
}


I found. it's working. thank you.

geoffrey.mcgill
Feb 19, 2015, 9:32 PM
Glad to see you have solved the problem.

As well, when I review the documentation for Panel, I do not see a method called getAttribute(). I would assume that is why you were getting the JavaScript error.