none
Get Selected Rows in JSGrid RRS feed

Answers

  • You are gonna wanna get a reference to the grid on the page and call GetSelectedRecordKeys(false);  This will return an array of recordKeys.  In Project Center the record keys correspond to the project guids.

    var pc;
    
    _spBodyOnLoadFunctionNames.push("ProjectCenterMain");
    
    function ProjectCenterMain() {
        pc = new ProjectCenterExtension();
    }
    
    
    function ProjectCenterExtension() {
        var _grid;
        var _satellite;
        //Prevent javascript errors if PJ or the AddGridSatellite function are not defined
        if (window.PJ == null || PJ.AddGridSatelliteInitializationNotifier == null) {
            return;
        }
    
        //Use the PJ.AddGridSatelliteInitializationNotifier function to get an instance of the satellite
        PJ.AddGridSatelliteInitializationNotifier
        (
        function (satellite) {
            if (PJ.ProjectCenterSatellite != null) {
                _satellite = satellite;
                _grid = satellite.GetJsGridControlInstance();
            }
        }
        );
    
        this.DisplaySelectedRecords = function () {
            var selection = _grid.GetSelectedRecordKeys(false);
        }
        
    }
    Wednesday, February 17, 2010 6:06 AM
    Moderator

All replies

  • You are gonna wanna get a reference to the grid on the page and call GetSelectedRecordKeys(false);  This will return an array of recordKeys.  In Project Center the record keys correspond to the project guids.

    var pc;
    
    _spBodyOnLoadFunctionNames.push("ProjectCenterMain");
    
    function ProjectCenterMain() {
        pc = new ProjectCenterExtension();
    }
    
    
    function ProjectCenterExtension() {
        var _grid;
        var _satellite;
        //Prevent javascript errors if PJ or the AddGridSatellite function are not defined
        if (window.PJ == null || PJ.AddGridSatelliteInitializationNotifier == null) {
            return;
        }
    
        //Use the PJ.AddGridSatelliteInitializationNotifier function to get an instance of the satellite
        PJ.AddGridSatelliteInitializationNotifier
        (
        function (satellite) {
            if (PJ.ProjectCenterSatellite != null) {
                _satellite = satellite;
                _grid = satellite.GetJsGridControlInstance();
            }
        }
        );
    
        this.DisplaySelectedRecords = function () {
            var selection = _grid.GetSelectedRecordKeys(false);
        }
        
    }
    Wednesday, February 17, 2010 6:06 AM
    Moderator
  • Hi Patrick,

    Thanks for your solution.

    Can you suggest me how to get the row data and specific cell information of a key in the selection array?

    Wednesday, April 20, 2011 6:12 PM