Friday, October 14, 2016

Load JQGrid Using API Calls HTML


<html>
<head>

    <script src="ClientGlobalContext.js.aspx" type="text/javascript"></script>
    <script src="/WebResources/Jquery.min.js" type="text/javascript"></script>
    <script src="/WebResources/bootstrap.min.js" type="text/javascript"></script>
    <script src="/WebResources/grid.locale_en.js" type="text/javascript"></script>
    <script src="/WebResources/jquery.jqgrid.min.js" type="text/javascript"></script>

    <link href="/WebResources/bootstrap.css" rel="stylesheet" type="text/css">
    <link href="/WebResources/ui.jqgrid.css" rel="stylesheet" type="text/css">
    <link href="/WebResources/jquery_ui.css" rel="stylesheet" type="text/css">

    <style>
        .ui-jqgrid tr.jqgrow td {
            white-space: normal !important;
            height: auto;
            vertical-align: text-top;
            padding-top: 2px;
        }
    </style>


    <script type="text/javascript">

//You can user above code for get Parameter from Query String

        var getQueryString = function (field) {
            var href = decodeURIComponent(window.location.href);
            var reg = new RegExp('[?&]' + field + '=([^&#]*)', 'i');
            var string = reg.exec(href);
            return string ? string[1] : null;
        };

        var SerialNumber = getQueryString('serialnumber');
        var ProductNumber = getQueryString('productnumber');


        $(function () {
            var snrUrl = "URL"; //Pass Your URL Here
            //debugger;
            $.ajax({
                type: "GET",
                url: snrUrl,
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: successCallBack,
                error: errorCallBack

            });
        });
        function successCallBack(result) {
//Hidden the Image Once the Service Gets Success Result
            document.getElementById("Loading").style.visibility = 'hidden';

            $("#JQGridLoad").jqGrid({ //set your grid id
                data: result, //insert data from the data object we created above
                datatype: 'local',
//Pass Coloumn Name Below
                colNames: ['Number',
                    'Description’
], //define column names
                colModel: [
                { name: ' Number', index: 'Number', key: true, width: 200 },
                { name: 'Description', index: 'Description', key: true, width: 500 }
                ], //define column models
                celledit: false,
                loadtext: "Loading...",
                sortname: 'Number', //the column according to which data is to be sorted; optional
                viewrecords: true,
                sortorder: "asc",
                caption: "Data" // Set the Caption
            });
        }
        function errorCallBack(result) {
            alert(result.data);
        }
    </script>
    <meta>
    <meta>
</head>
<body style="overflow-wrap: break-word;">
    <table id=" JQGridLoad"></table>

//Pass the Image Which you Required so that it will Load and Hide till the Data Gets Load From Service
    <img style="padding-left:48%" id="Loading" src="/webresources/ _/scripts/progressindicator"><table id="loader"></table>


</body>

</html>


No comments:

Post a Comment

Day 11 - Customizing Option Sets Dropdown Fields with JavaScript

  In this Blog, we will see how to Customizing Option Sets Dropdown Fields with JavaScript label1 = formContext.getAttribute( "bosch_op...