PDA

View Full Version : button reference



nityajs
26 Aug 2009, 10:47 AM
Hi All,
I have created a button with id:"save" in one of my form panels. when confirm message yes is clicked I wanted to submit this save button.
I am trying to get the button reference like Ext.getCmp('save') but this says undefined error.

Please let me know if there is any other way to create button with id.
Any idea/ hint would be highly appreciated.

Animal
26 Aug 2009, 11:46 AM
Ext.getCmp finds a Component by its id.

You have a bug somewhere.

nityajs
26 Aug 2009, 12:06 PM
Hi Animal,

When I look at the HTML tab of the firebug, I see the below html code for save button.

<table id="Save" class="x-btn x-btn-noicon" cellspacing="0" style="width: 75px;">
<tbody class="x-btn-small x-btn-icon-small-left">
<tr>

</tr>

<tr>
<td class="x-btn-ml">
<i> </i>


</td>

<td class="x-btn-mc">
<em class="" unselectable="on">
<button id="ext-gen272" class="x-btn-text" type="button">Save</button>


</em>


</td>

<td class="x-btn-mr">

</td>


</tr>

<tr>
<td class="x-btn-bl">
<i> </i>


</td>

<td class="x-btn-bc"/>

<td class="x-btn-br">
<i> </i>


</td>


</tr>


</tbody>

I am confused why the id that I gave to button is used as table id. This is the reason I dont get the button reference using Ext.getCmp().

Any idea on why code is generated this way. I am using Ext3.0.

steffenk
26 Aug 2009, 1:26 PM
you confuse component with dom element, and JS is case-sensitive:
Ext.getCmp('Save')

nityajs
26 Aug 2009, 4:16 PM
Yes even though I use Ext.getCmp('Save') I get Object HTML Table Element which I cannot submit. Is there any way to access the button in the table element?

Animal
27 Aug 2009, 2:05 AM
No you don't.

When you use Ext.getCmp you get the Button Object

When you use Ext.get, you get the table Element.