Javascript Dojotoolkit store.GetValue当文本框位于内部时

Javascript Dojotoolkit store.GetValue当文本框位于内部时,javascript,dojo,dojox.grid.datagrid,dojox.grid,Javascript,Dojo,Dojox.grid.datagrid,Dojox.grid,我有一个关于dojotoolkit的问题。 我有一个DataGrid,希望在其中获得一个值。棘手的是,这个值是一个 文本框 我的DataGrid结构如下所示: grid = new dojox.grid.DataGrid({ store: store, structure: [ { name: "Quantity", field: "Quantity", width: "30px",

我有一个关于dojotoolkit的问题。 我有一个DataGrid,希望在其中获得一个值。棘手的是,这个值是一个 文本框

我的DataGrid结构如下所示:

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"); 
我还有一个按钮,可以点击。 如果单击按钮,则执行此功能:

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);
}
name变量设置正确,但我没有从quantity中获得任何信息。 我想我会得到文本框,但我什么也没有收到


有人知道如何访问存储区的字段吗?

我认为,因为Textbox是一个小部件,您可以通过设置id来访问它的值,并通过

dijit.byId("YourTB").get('value');

您好,Miriam

您是否尝试设置store.getValue(val,'name')?是的,但我没有得到任何东西。我想你已经检查了val在这一点上是否有任何值…val可能有正确的值,至少我在使用store.getValue(val,'Value')时得到了正确的值。在我的XML中,Name被设置为“testValue1”,这就是我得到的结果。我认为,因为Textbox是一个小部件,所以您可以通过设置id来访问它的值,并通过dijit.byId(“YourTB”).get(“value”)来获取元素。