PDA

View Full Version : [Solved] cell renderer problem



madkris
27 Aug 2009, 3:59 AM
Hi guys,

I have been stuck with this problem of mine since this morning, Im hoping someone could shed some light into this.Here's my scenario.

I have a toolbar button in my main GridPanel which on click event shows a Window which has two GridPanels, Grid A & B respectively. Grid A has two cell renderers, one for a html input field and second for a html anchor which calls a function to add the user input along with some other data into Grid B. For now I have set the handler of both my window buttons Save and Cancel to close the window. On the first instance my window gets rendered the renderers work fine and I am able to get the value of the input field using Ext.get(val).getValue() but when I click my toolbar button again after the window closes, Ext.get(val).getValue() returns nothing.I tried inspecting the link on the first instance and second one.. the input fields id is still the same. I also tried using firebug console with the this code
alert(Ext.get('1').getValue()); on first instance it returns the input while the second one returns nothing, it doesnt say null or undefined just returns nothing. I have posted my column model and cell renderers, I have also attached my code if the code below is insufficient information.

thanks in advance,
-kris


productCM = function () {
return new Ext.grid.ColumnModel([{
header: 'ID',
sortable: false,
width: 30,
dataIndex: 'productid'
},
{
header: 'Product Name',
sortable: false,
dataIndex: 'name'
},
{
header: 'Price',
sortable: false,
dataIndex: 'price'
},
{
header: 'Quantity',
sortable: false,
width: 68,
dataIndex: 'productid',
renderer: txtQty
},
{
header: ' ',
sortable: false,
width: 40,
dataIndex: 'productid',
renderer: addLink
},
]);
}
txtQty = function (val) {
return '<input type=&quot;text&quot; style=&quot;width:60px;height:20px;&quot; id=' + val + ' onKeyPress=&quot;return numbersOnly(event, false);&quot;>';
}
addLink = function (val) {
return '<a href=&quot;#&quot; onClick=&quot;addProduct(\'' + val + '\');&quot; style=&quot;cursor: pointer;&quot;><u>Add</u></a>';
}