i have a question regarding the dojotoolkit. I have a DataGrid and want to get a value inside of it. The tricky part is, that the value is a TextBox.
My structure for the DataGrid looks like this:
grid = new dojox.grid.DataGrid({
store: store,
structure: [
{
name: "Quantity", field: "Quantity", width: "30px",
formatter: function(item)
{
var tb = new dijit.form.TextBox(
{
name: "quantity",
value: "1",
placeHolder: "quantity",
});
return tb;
}
},
{ name: "Value", field: "Value", width: "auto"}
]
}, "bGrid");
I have furthermore a button which can be clicked. If the button was clicked, this function is executed:
myClass.prototype.Test = function Test(tItem)
{
var item = tItem;
var val = grid.getItem(item.value); //Value in this case is an integer refering to the position of my item in the grid
var quantity;
var name;
if(val!==null){
var store = grid.store;
quantity = store.getValue(val, 'Quantity');
name = store.getValue(val, 'Value');
}
console.log("Quantity "+quantity+ " Name: "+name);
}
the name variable is set correctly but i don't get anything from quantity. I would guess that i would get the TextBox but i receive nothing.
Does anybody know how to access the field of the store ?
I think because the Textbox is a widget you can get access to its value by setting an id for it and get the element by
dijit.byId("YourTB").get('value');
Regards, Miriam