从Code Behind创建商店并过滤其内容并将其绑定到Combobox Ext.Net 2.2

时间:2013-09-17 10:39:53

标签: filter store ext.net

我在代码隐藏的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);

0 个答案:

没有答案