macha
macha

Reputation: 7487

Get value of sibling - extjs

Hello I have a checkbox and hidden element placed in the same table data cell. When the checkbox is checked, I would get its id using Ext.query method. I have the ID of the whole record that maps to the database in the hidden element which is sitting next to this checkbox element.

I would need to retrieve the value of this element. I could use next() in JQuery to retrieve this, I am newbie to extjs and have no idea how I would do to retrieve this in EXTJS.

<input type="checkbox" name="delete_value_{0}" id="delete_value_{0}"/> 
<input type="hidden" name="hidden_value_id_{0}" id="hidden_value_id_{0}" />

This is how they are placed into a table data cell(td).

{0} would dynamically set the counter value. (since rows would be generated dynamically)

Upvotes: 3

Views: 3962

Answers (3)

Evan Trimboli
Evan Trimboli

Reputation: 30082

You can use next - http://dev.sencha.com/deploy/dev/docs/?class=Ext.Element&member=next

var other = Ext.fly(box).next('input');

Upvotes: 3

Amol Katdare
Amol Katdare

Reputation: 6760

If you have the checkbox id and you want to retrieve the hidden input's value, following little line should do the trick -

Ext.DomQuery.selectNode('input[id="delete_value_{0}"] ~ input').value

Reference - DomQuery

Upvotes: 0

Tommi
Tommi

Reputation: 8608

You can retrieve the element with Ext.get("hidden_value_id_{0}").

Upvotes: 0

Related Questions