Pending Review
Last Updated: 25 Aug 2016 14:19 by Matthew
Matthew
Created on: 25 Aug 2016 14:19
Category: UI for ASP.NET AJAX
Type: Feature Request
0
Client-side object model
Would be really nice if there was a clearly defined client-side object model for the radGrid. We created a function like the one below by deconstructing the header menu. The jQuery selectors to find the container and affected dropdown lists are really hacky and very brittle.  Reliance on magic strings means that upgrading to future versions is likely to break code like this.

Ideally we should be able to reference (and alter) a client-side filter operators collection like this: grid.headerMenu.filterOperators

function headerMenuShowing(sender, args) {
    var $container = jQuery("div[id^='" + sender.get_id() + "_rghcMenu']");
    var $lists = $container.find("ul.rcbList");
    var gridCol = args.get_gridColumn();
    var dataType = gridCol.get_dataType();
    switch (dataType) {
        case "System.String":
            $lists.find("li:contains('GreaterThan')").hide();
            $lists.find("li:contains('LessThan')").hide();
            $lists.find("li:contains('IsEmpty')").hide();
            $lists.find("li:contains('NotIsEmpty')").hide();
            break;
        case "System.Int32":
        case "System.Int64":
        case "System.Double":
        case "System.Decimal":
        case "System.DateTime":
            $lists.find("li:contains('GreaterThan')").show();
            $lists.find("li:contains('LessThan')").show();
            break;
    }
}

0 comments