1

我正在从代码隐藏的 GridPanel 的组件列中创建组合框。需要创建一个商店并根据某些条件过滤其内容并将其绑定到创建的组合框。商店正在绑定到组合,但过滤器不起作用。请帮助我为此获得正确的解决方案。我的代码片段如下所示。

List<object> storeDataProductClass= new List<object>();
storeDataProductClass.Add(new { text = "Class0", value = "Class0", productIndex = 0});
storeDataProductClass.Add(new { text = "Class1", value = "Class1", productIndex = 1});
storeDataProductClass.Add(new { text = "Class2", value = "Class2", productIndex = 2});
storeDataProductClass.Add(new { text = "Class3", value = "Class3", productIndex = 3});
storeDataProductClass.Add(new { text = "Class4", value = "Class4", productIndex = 4});


    Ext.Net.ComboBox cmbClass = new ComboBox();
            cmbClass.ID = "cmbClass_" + i;
    Model classModel = new Model();
    classModel.Fields.Add(new ModelField("text", ModelFieldType.String));
    classModel.Fields.Add(new ModelField("value", ModelFieldType.String));
    classModel.Fields.Add(new ModelField("productIndex", ModelFieldType.Int));
    Ext.Net.Store storeClass = new Ext.Net.Store();
    storeClass.ID = "storeClass_" + i;
    storeClass.AutoDataBind = true;
    storeClass.Model.Add(classModel);
    storeClass.DataSource = storeDataProductClass;
    storeClass.DataBind();
    storeClass.Filter("productIndex", i.ToString());
    cmbClass.Store.Add(storeClass);
cmbClass.DisplayField = "text";
cmbClass.ValueField = "value";
compColumn.Component.Add(cmbClass);
4

0 回答 0