Kliensoldali RecroGrid

This topic contains the following sections:

Kliensoldali osztály létrehozása

A kliensoldali testreszabáshoz egy Recrovit.WebCli.RecroGrid-ből származtatott osztályt kell létrehozni, és az RGO_ScriptControl opciós paraméterben az osztály nevét megadni.

Create client-side class
//Defining a client-side custom class
Demo.RGPerson = function (args) { Recrovit.WebCli.RecroGrid.call(this, args); };
Demo.RGPerson.prototype = Object.create(Recrovit.WebCli.RecroGrid.prototype);

//In the entity, in the optional parameter RGO_ScriptControl: Demo.RGPerson
//

Eseménykezelő metódusok

Az események kezelésére, illetve a kliens-szerver közti kommunikáció befolyásolására számos virtuális metódus áll rendelkezésre, ami az osztálydefiníciót követően megadható.

A következő táblázat felsorolja az elérhető eseményekhez tartozó virtuális metódusokat.

virtual
OnBeginSelect: function (dialogContent, selectParams) { },
OnInit: function () { },
OnInitComplete: function () { },
OnInitDetails: function (idx, mode, fnCallback) { },//fnCallback(dialogContent)
OnDeleteData: function (idx, args) { },
OnUpdatedData: function (success) { },
OnDeletedData: function () { },
OnRender: function (idx, itemsPerPage, keepHeader) { },
OnAddItem: function (idx, prepend) { },//return
OnRemoveItem: function (idx, fnCallback) { },
OnSetToolbarState: function () { },
OnInitScroll: function () { },
OnSetStatusbarInfo: function () { },
OnClick: function (idx, row, event) { },//return
OnDblClick: function (idx, row, event) { },//return
OnSelectCallback: function (res, toProperty) { },
OnSelectRow: function (idx, row, select) { },
OnSelectData: function (res, toProperty, fromDialog, parentCtrl) { },//Called during selection in select mode.
OnClientValidator: function (currDialog, data) { },//return
OnDialogPropertyMessages: function (currDialog, messages) { },
OnRefresh: function (reset) { },
OnCreateCustomMenu: function (event) { },//return
OnCreateContextMenu: function (event) { },//return
OnClickCustomMenu: function (item) { },
OnCustomFunction: function (item) { },
OnCustomFunctionCallback: function (item, result) { },//If it returns true, it proceeds to the next row.
OnServerCallback: function (rgServiceParams, fnCallback, fnCallbackSuccess, fnCallbackError, fnCallbackCaller, ctx) { },
OnGetDetailsData: function (dialogContent) { },//return
OnGetDictionary: function (id, element, data, selected, callback) { },
//
Examples
//Handling the completion event of RecroGrid initialization
Demo.RGPerson.prototype.OnInitComplete = function () {
    Recrovit.WebCli.RecroGrid.prototype.OnInitComplete.call(this);
}

//Handling a custom function on the client side
Demo.RGPerson.prototype.OnCustomFunction = function (item) {
    var thisCtrl = this,
        name = item.target,
        idx = item.idx;

    if (name == 'fnname') {
        if (idx != null) {
            //Function per element
            var data = thisCtrl.RGF_GetRowData(idx),
                coly = data['rg-col-3072'].Value;
        }
        else {
            //Global function
        }
    }
    Recrovit.WebCli.RecroGrid.prototype.OnCustomFunction.call(this, item);
}
//Returning the server-side handling of a custom function
Demo.RGPerson.prototype.OnCustomFunctionCallback = function (item, result) {
    if (result.Results != undefined) {
        //Server response
    }
    Recrovit.WebCli.RecroGrid.prototype.OnCustomFunctionCallback.call(this, item, result);
}

//Custom handling of server call returns
Demo.RGPerson.prototype.OnServerCallback = function (rgServiceParams, fnCallback, fnCallbackSuccess, fnCallbackError, fnCallbackCaller, ctx) {
    // fnCallbackSuccess(result, context, callback) is only called on successful execution; if the return is false, the execution stops
    // fnCallbackError(result, context, callback) is only called on an error; if the return is false, the execution stops
    // fnCallback(result, context) is called in all cases, if the previous two did not stop the execution
    // fnCallbackCaller(res): callback to the caller. Receives a bool parameter, which is false if the callback return value is false, otherwise true.

    var origCallback = fnCallbackSuccess;
    var fn = function (result, context) {
        if (rgServiceParams.ProcessName == 'InitDetails') {
            //Custom initialization on the client side after displaying a form dialog
        }
    };
    //Calling base.OnServerCallback
    Recrovit.WebUI.RecroGrid.prototype.OnServerCallback.call(this, rgServiceParams, fnCallback, function (result, context) {
        if ($.isFunction(origCallback)) {
            origCallback(result, context, fn);
        }
        else {
            fn(result, context);
        }
    }, fnCallbackError, fnCallbackCaller, ctx);
}
//

Publikus metódusok

public
this.RGF_Init = function (skeleton) { };
this.RGF_Render = function (idx, itemsPerPage, keepHeader) { };
this.RGF_SetToolbarState = function () { };
this.RGF_InitScroll = function () { };
this.RGF_SetStatusbarInfo = function () { };
this.RGF_Click = function (idx, row, event) { };
this.RGF_DblClick = function (idx, row, event) { };
this.RGF_Select = function (idx, select) { };
this.RGF_SelectData = function (idx) { };
this.RGF_ClientValidator = function (currDialog, data) { };
this.RGF_DialogPropertyMessages = function (currDialog, messages) { };
this.RGF_SetSort = function (sortArray) { };
this.RGF_Refresh = function (reset) { };
this.RGF_CreateCustomMenu = function (event) { };
this.RGF_CreateContextMenu = function (event) { };
this.RGF_ClickCustomMenu = function (item) { };
this.RGF_CustomFunction = function (item) { };
this.RGF_CustomFunctionNext = function (menuItem, prevIdx) { };
this.RGF_CustomFunctionCallback = function (item, result) { };

this.RGF_UpdateData = function (idx, resultRow) { };
this.RGF_DeleteData = function (idx, nextCallback) { };

this.RGF_GetItemIdx = function (from) { };
this.RGF_GetData = function (idx) { };
this.RGF_GetRowData = function (idx, grid) { };
this.RGF_GetItemEKey = function (item) { };
this.RGF_GetEKeyIdx = function (idx) { };
this.RGF_GetEKey = function (data, hash) { };
this.RGF_GetFriendlyKey = function (idx) { };
this.RGF_GetColDef = function (portableName, clientName) { };

this.RGF_OpenFilterDialog = function () { };
this.RGF_GetDetails = function () { };
this.RGF_CloseDetails = function (callback) { };
this.RGF_InitDetails = function (idx, mode, initCallback, ctx) { };//initCallback(dialogContent)
this.RGF_GetDetailsData = function (dialogContent) { };
this.RGF_GetDictionary = function (id, element, data, selected, callback) { };
this.RGF_GetRecroDictStr = function (id) { };

this.RGF_CreatePlotOptions = function (params) { };
this.RGF_Plot = function (target, options) { };
//

See Also

Other Resources