This is a migrated thread and some comments may be shown as answers.

Custom Filtring - FilterDescriptor.Member (2011_Q3.1116)

0 Answers 68 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mouadh
Top achievements
Rank 1
Mouadh asked on 22 Feb 2013, 07:18 AM
Hi,
we use RadGridView to display a collection of objects.
the model of this collection is as follows:

Public Class Model
{
public Prop1;
public  Prop2;
..
private Dictionary<string, MethodInfo> extensionMethodeByfqdnNameCache = new Dictionary<string, MethodInfo>();
public object this[string name]
        {
            get
            {
                if (extensionMethodeByfqdnNameCache.Keys.Where(key => key == name).FirstOrDefault() == null)
                {

                    string folderPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
 
                    string assemblyFilePath = name.Split(',')[1].Trim();
             
                    string[] assembliesSearchRslt = Directory.GetFiles(folderPath, assemblyFilePath   ".dll", SearchOption.AllDirectories);

       
                    if (assembliesSearchRslt.Count() < 1) throw new Exception("Cannot load assembly");

      
                    Assembly assembly = Assembly.LoadFrom(assembliesSearchRslt[0]);


                    var currentType = this.GetType();
         
                    var methodeinfo = currentType.GetMethod("GetExtensionObject");
                 
                    var extensionType = assembly.GetType(name.Split(',')[0].Trim());

                    MethodInfo generic = methodeinfo.MakeGenericMethod(extensionType);
                    extensionMethodeByfqdnNameCache.Add(name, generic);
                }

                return extensionMethodeByfqdnNameCache.Where(dic => dic.Key== name).FirstOrDefault().Value.Invoke(this, null);
            }
        }
}

The model is shared across multiple assembly.
using a modular mechanism personalized.
the grid is always displayed and each change (module) are added Propertie anotre specific model:
and recovering these properties through the binding as follows:
Model. [^ ClassName, Assembly]. Property

Note: Model contain a method "GetExtension" ClassName to load a Dicationnary.

Binding the work properly.

we create a personalized component filrage and we could fill it with the values ​​of this column grid personalized.

but when we must create a filter and passes FilterDescriptor Member of the filter [ClassName, Assembly]. Property with the operator Equal
unfortunately this does not filter the grid.

FilterDescriptor.Member is on, does that make a filter on the Model property declared in the Model class and can not invoke the method this [string name] to retrieve the extended properties?

how to do the filtering mechanism with an extension properties on the Model?

if you must use IColumnFilterDescriptor found in Q1 2012?

No answers yet. Maybe you can help?

Tags
GridView
Asked by
Mouadh
Top achievements
Rank 1
Share this question
or