I am looking for the examples for jqgrid with salesforce lightning. How to inject URL into jqgrid javascript??

so far i have managed to pull data from salesforce apex component but for supporting inline-edit i need to use URL that will call apex component's method with @RemoteAction

$(document).ready(function () {
    action.setCallback(this, function(a) {
        if (a.getState() === "SUCCESS") {
            result = a.getReturnValue();
            var editActionOptions = {
                keys: true,
                oneditfunc: function (rowid) {
                    console.log("row with rowid=" + rowid + " is editing.");
                aftersavefunc: function (rowid, response, options) {
                    console.log("row with rowid=" + rowid + " is successfuly modified.");
                editurl: 'clientArray',
                datatype: "local",
                colModel: [
                        label: "Edit Actions",
                        name: "actions",
                        width: 100,
                        formatter: "actions",
                        formatoptions: {
                            keys: true,
                            editOptions: {},
                            addOptions: {},
                            delOptions: {}
                        labe: 'ID',
                        name: 'empid',
                        width: 75
                        label : 'Name',
                        name: 'Name',
                        width: 140,
                        editable: true // must set editable to true if you want to make the field editable
                        label: 'dob',
                        name: 'dob',
                        width: 100,
                        editable: true
                        label: 'dln',
                        name: 'dln',
                        width: 120,
                        editable: true
                sortname: 'empid',
                loadonce: true,
                onSelectRow: editRow,
                editParams: editActionOptions,
                width: 780,
                height: 400,
                rowNum: 150,
                pager: "#jqGridPager"

        } else if (a.getState() === "ERROR") {
            $A.log("Errors", a.getError());


First of all Salesforce strongly recommends not to use third party libraries for building functionalities using aura components.

If you still want to pursue this option.

ltng:require tag to load the library from a static resource and use the afterscriptloaded attribute to call a helper function to bind jqgrid to your html dom


    styles="{!$Resource.SLDSv1 + '/assets/styles/lightning-design-system-ltng.css'}"

    scripts="{!$Resource.jsLibraries + '/jsLibOne.js'}"

    afterScriptsLoaded="{!c.scriptsLoaded}" />

scriptsLoaded function will contain the code to bind jqgrid tables to dom.

  • sorry about confusion, i am aware of javascript static urls. I need to reference Component (Apex).
    – dev.sforce
    Jan 21 '17 at 3:53
  • can you clarify what you mean when you say you want to reference component
    – RedDevil
    Jan 21 '17 at 4:14
  • jqrid needs url to action on the server side which in case of salesforce it is apex component having method @RemoteAction
    – dev.sforce
    Jan 21 '17 at 4:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.