/// <summary> /// From request retrieves data selected by Checkboxify /// </summary> /// <typeparam name="T">Type of selection data (type of originally configured column)</typeparam> /// <param name="req">Request</param> /// <returns>Set of selection</returns> public static T[] GetSelectionIds <T>(this PowerTableRequest req) { if (!req.Query.AdditionalData.ContainsKey("Selection")) { return(new T[0]); } var s = req.Query.AdditionalData["Selection"]; var result = s.Split('|').Select(ValueConverter.Convert <T>).ToArray(); return(result); }
public virtual PowerTableRequest ExtractRequest(ControllerContext context) { if (_request != null) { return(_request); } if (context.HttpContext.Request.HttpMethod == "GET") { var token = context.HttpContext.Request.QueryString["q"]; _request = TokenStorage.Lookup(token); return(_request); } var request = context.RequestContext.HttpContext.Request; request.InputStream.Seek(0, SeekOrigin.Begin); string jsonData = new StreamReader(request.InputStream).ReadToEnd(); _request = JsonConvert.DeserializeObject <PowerTableRequest>(jsonData); _request.Configurator = _configuration; return(_request); }
/// <summary> /// Returns all columns that are being hidden on client-side /// </summary> /// <param name="request">Request</param> /// <param name="conf">Table configurator</param> /// <returns>Array of PropertyInfos that are hidden</returns> public static PropertyInfo[] GetHiddenColumns(this PowerTableRequest request, IConfigurator conf) { return(GetHiddenColumns(request.Query, conf)); }
/// <summary> /// Returns all columns that are being shown on client-side /// </summary> /// <param name="request">Request</param> /// <returns>Array of strings denoting names of shown columns</returns> public static string[] GetShownColumns(this PowerTableRequest request) { return(GetShownColumns(request.Query)); }
/// <summary> /// Retrieves values of ConfirmationForm /// </summary> /// <typeparam name="T">ConfirmationForm ViewModel type</typeparam> /// <param name="request">PowerTables request</param> /// <param name="converters">Converters to be supplied to Json.Net</param> /// <returns>ConfirmationForm ViewModel</returns> public static T ConfirmationForm <T>(this PowerTableRequest request, params JsonConverter[] converters) { return(ConfirmationForm <T>(request.Query, converters)); }
/// <summary> /// Retrieves values of ConfirmationForm /// </summary> /// <typeparam name="T">ConfirmationForm ViewModel type</typeparam> /// <param name="request">PowerTables request</param> /// <returns>ConfirmationForm ViewModel</returns> public static T ConfirmationForm <T>(this PowerTableRequest request) { return(ConfirmationForm <T>(request.Query)); }
/// <summary> /// Retrieves values of ConfirmationForm /// </summary> /// <typeparam name="T">ConfirmationForm ViewModel type</typeparam> /// <param name="request">PowerTables request</param> /// <param name="serializerSettings">Serializer settings to be supplied to Json.Net</param> /// <returns>ConfirmationForm ViewModel</returns> public static T ConfirmationForm <T>(this PowerTableRequest request, JsonSerializerSettings serializerSettings) { return(ConfirmationForm <T>(request.Query, serializerSettings)); }
/// <summary> /// Retrieves column filter value from incoming request. /// Please not that RangeFilter uses RangeTuple as TFilteringKey /// </summary> /// <typeparam name="TFilteringKey">Type of filter key</typeparam> /// <param name="column">Column</param> /// <param name="request">Incoming request</param> /// <returns></returns> public static Tuple <bool, TFilteringKey> ExtractFilteringKey <TFilteringKey>( this IColumnConfigurator column, PowerTableRequest request) { return(ExtractFilteringKey <TFilteringKey>(column, request.Query)); }
/// <summary> /// Retrieves values of form /// </summary> /// <typeparam name="T">Form ViewModel type</typeparam> /// <param name="request">PowerTables request</param> /// <returns>Form ViewModel</returns> public static T Form <T>(this PowerTableRequest request) { return(Form <T>(request.Query)); }