locked
Ribbon Loading validation RRS feed

  • Question

  • Hi everybody, I have the following problem, I want to run a validation Ribbon controls Timesheet page, ie when the user already "sent Timesheet" and access this page again, buttons like "save", "Send status" are disabled, how I can I catch that event when it ends? I try the following code but does not work, any suggestions.

    SP.SOD.executeOrDelayUntilScriptLoaded(function () {
                            if ($('a[id=Ribbon.ContextualTabs.TiedMode.Home.Sheet.SubmitTimesheet-Large]')[0].className.indexOf("disabled") >= 0) {
                                DisEnableButtons('StatusReport');
                            }
                            else {
                                DisEnableButtons('D_SendTimesheet');
                            }
                        }, "Init.js");
    Thanks.


    .Net Developer and SharePoint programmer

    Thursday, November 7, 2013 12:48 AM

Answers

  • Hello everyone and found a way to simulate my validation, first create this GetGridRowStyleId
    function GetGridRowStyleId(record) {
            if (_firstRecordDone) return;
            try {
                MyValidation();
            } catch (e) { }
        }
    
    
    
    PJ.AddGridSatelliteInitializationNotifier
        (
            function (satellite) {
                try {
                    if (PJ.TimesheetSatellite != null) {
                        satellite = PJ._NotifySatelliteInitComplete.arguments[0];
                        _satellite = satellite;
                        _timesheetGUID = _satellite._pageProperties.prdUid.toString();
                        _grid = satellite.GetJsGridControlInstance();
                        _grid.SetDelegate(SP.JsGrid.DelegateType.GetGridRowStyleId, GetGridRowStyleId);
                    }
                } catch (e)
                { }
            }
        );

    handler and within this add my validations, you just have to have a caution as this handler will fire for each record with the grid, greetings.

    .Net Developer and SharePoint programmer

    • Marked as answer by Carlos Padilla Thursday, November 7, 2013 11:09 PM
    Thursday, November 7, 2013 11:09 PM