none
Apply Custom Filter Views on Project center Programatically RRS feed

  • General discussion

  • Hi All ,

    I am working on Project Online 2013 and come across one requirement where user wants customize project center view based on customfilter.

    Scenario : Based on the user role  when user try to change the view from ribbon dropdown. Apply custom filter based on the given Column.

    Solution :

    var PMView = "f43163b6-847f-4e01-9e05-71db319225f6";

    //To get current view Id

     var ProjCenterComp=projectCenterComponent.get_GridSatellite();
     var viewid=ProjCenterComp.get_CurrentView()["uid"];

    //Check whether current view is matching your condition

           

    if(viewid==PMView)
     {

     if(userRole=="Business User")
            {

    //custom Filter query

            var    xmlQueryfltr="<Filter><FieldComparison><Field>RES_NAME</Field><Operator>Equals</Operator><Operand>"+Loginname+"</Operand></FieldComparison></Filter>";

    //This statement directly render your view in project center

                projectCenterComponent.get_GridSatellite().Filter(xmlQueryfltr, null);
            }

    }

    To Create xml Query 

    1.go in to the normal custom filter option provided by project online on ribbon select the filter which you want to apply and click on ok.

    2. Go the Browser console and hit below query

    var x=projectCenterComponent.get_GridSatellite()

    x.get_FilterState()


    Amey Pusalkar

    Friday, October 28, 2016 7:00 AM