Hello,
I have 1 question about getting entityfields from TypedList.
Currently this field is private :-(
I have this method:
public static void CreateSortorder(ITypedListLgp2 typedList, SortExpression vSort, string sortstring)
{
if (!string.IsNullOrEmpty(sortstring))
{
List<string> sortlijst = new List<string>();
const string and = "~and~";
while (sortstring.Contains(and))
{
int pos = sortstring.IndexOf(and);
// we maken 1 lijn aan met filterdata
sortlijst.Add(sortstring.Substring(0, pos));
// de overschot van stringfilter aan de filter terug geven.
sortstring = sortstring.Substring(pos + and.Length, sortstring.Length - (pos + and.Length));
}
sortlijst.Add(sortstring);
foreach (string srt in sortlijst)
{
string[] param = srt.Split('-');
List<EntityFields2> ef = ((SD.LLBLGen.Pro.ORMSupportClasses.EntityFields2) (typedList.GetFieldsInfo()))._entityFields;
// get the involved field
IEntityField2 Sortfield = null; //((EntityFields2)EntityFieldsFactory.CreateEntityFieldsObject(entityType))[param[0]];
// build the sorter
switch (param[1])
{
case "asc":
vSort.Add(new SortClause(Sortfield, null, SortOperator.Ascending));
break;
case "desc":
vSort.Add(new SortClause(Sortfield, null, SortOperator.Descending));
break;
default:
throw new Exception("LLBLGEN custom Filter type not supported");
}
}
}
}
I use this method for my MVC telerik grid.
The grid does an action and that returns a json result. (The data for inside the grid)
Now the Telerik grid has his own techniek to send his filter, order by.
Now what i do is create the sortorder.
Can you help me out ?
Or is there a better way to work with LLBLgen objects --> to Json (And had sort, filter, group by support ?)
Thanks
Kris