Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Jared1Programmer

Pages: [1]
1
Alright so I figured it out this weekend. The first code snippet is the view and the second is the _layout page. What I did to get this to work correctly is I put the calls into the view but have the _layout render it. The second code snippet is the _layout file. I added in the header section @RenderSection("CSS", required: false). This may not be the best way to do this but it works. Hopefully this helps someone else and i get better at this.

Code snippet 1
Code: [Select]
@{
    ViewData["Title"] = "About";
    //Layout = null;
}
<h2>@ViewData["Title"]</h2>
<h3>@ViewData["Message"]</h3>

<!--jQuery dependencies-->

@section CSS{
    <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css" />
    <link href="https://paramquery.com/pro2/Content/css3.3.1/pqgrid.min.css" type="text/css" rel="stylesheet">
    <link href="https://paramquery.com/pro2/Content/css3.3.1/themes/office/pqgrid.css" type="text/css" rel="stylesheet">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
}

@section Scripts{
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
    <script src="https://paramquery.com/pro2/Content/js3.4.1/pqgrid.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

    <script>
    $(function () {
        var data = [[1, 'Exxon Mobil', '339,938.0', '36,130.0'],
        [2, 'Wal-Mart Stores', '315,654.0', '11,231.0'],
        [3, 'Royal Dutch Shell', '306,731.0', '25,311.0'],
        [4, 'BP', '267,600.0', '22,341.0'],
        [5, 'General Motors', '192,604.0', '-10,567.0'],
        [6, 'Chevron', '189,481.0', '14,099.0'],
        [7, 'DaimlerChrysler', '186,106.3', '3,536.3'],
        [8, 'Toyota Motor', '185,805.0', '12,119.6'],
        [9, 'Ford Motor', '177,210.0', '2,024.0'],
        [10, 'ConocoPhillips', '166,683.0', '13,529.0'],
        [11, 'General Electric', '157,153.0', '16,353.0'],
        [12, 'Total', '152,360.7', '15,250.0'],
        [13, 'ING Group', '138,235.3', '8,958.9'],
        [14, 'Citigroup', '131,045.0', '24,589.0'],
        [15, 'AXA', '129,839.2', '5,186.5'],
        [16, 'Allianz', '121,406.0', '5,442.4'],
        [17, 'Volkswagen', '118,376.6', '1,391.7'],
        [18, 'Fortis', '112,351.4', '4,896.3'],
        [19, 'Crédit Agricole', '110,764.6', '7,434.3'],
        [20, 'American Intl. Group', '108,905.0', '10,477.0']];

        var obj = {};
        obj.width = 700;
        obj.height = 400;
        obj.colModel = [{ title: "Rank", width: 100, dataType: "integer" },
        { title: "Company", width: 200, dataType: "string" },
        { title: "Revenues ($ millions)", width: 150, dataType: "float", align: "right" },
        { title: "Profits ($ millions)", width: 150, dataType: "float", align: "right" }];
        obj.dataModel = { data: data };
        $("#grid_array").pqGrid(obj);

    });
</script>
    }
<div id="grid_array"></div>

Code snippet 2
Code: [Select]
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>@ViewData["Title"] - ERPApp</title>

    <environment include="Development">


        <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
        <link rel="stylesheet" href="~/css/site.css" />


    </environment>
    <environment exclude="Development">
        <link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/css/bootstrap.min.css"
              asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
              asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" />
        <link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" />
    </environment>
    @RenderSection("CSS", required: false)

</head>
<body>
    <nav class="navbar navbar-inverse navbar-fixed-top">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a asp-area="" asp-controller="Home" asp-action="Index" class="navbar-brand">ERPApp</a>
            </div>
            <div class="navbar-collapse collapse">
                <ul class="nav navbar-nav">
                    <li><a asp-area="" asp-controller="Home" asp-action="Index">Home</a></li>
                    <li><a asp-area="" asp-controller="Home" asp-action="About">About</a></li>
                    <li><a asp-area="" asp-controller="Home" asp-action="Contact">Contact</a></li>
                </ul>
            </div>
        </div>
    </nav>

    <partial name="_CookieConsentPartial" />

    <div class="container body-content">
        @RenderBody()
        <hr />
        <footer>
            <p>&copy; 2018 - ERPApp</p>
        </footer>
    </div>

    <environment include="Development">

        <script src="~/lib/jquery/dist/jquery.js"></script>
        <script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
        <script src="~/js/site.js" asp-append-version="true"></script>
    </environment>
    <environment exclude="Development">
        <!-- <script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-3.3.1.min.js"
                asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
                asp-fallback-test="window.jQuery"
                crossorigin="anonymous"
                integrity="sha384-tsQFqpEReu7ZLhBV2VZlAu7zcOV+rXbYlF2cqB8txI/8aZajjp4Bqd+V6D5IgvKT">
        </script>-->
        <script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/bootstrap.min.js"
                asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"
                asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal"
                crossorigin="anonymous"
                integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa">
        </script>
        <script src="~/js/site.min.js" asp-append-version="true"></script>
    </environment>

    @RenderSection("Scripts", required: false)
</body>
</html>


2
Help for ParamQuery Grid (free version) / $(...).pqGrid is not a function
« on: November 01, 2018, 12:49:40 am »
I am currently trying to get a simple grid up and running for my company to evaluate and see if we want to buy the full version. I am using visual studios and am using a asp.net core project which i am not the most versed in. I am using the same code from getting started. I downloaded the zip file and put the files in my project to so that i can call them. I even downloaded the nuget plugins and changed the calls to what i found on the jsfiddle http://jsfiddle.net/pb5kpred/ to see if that would fix it but it did not. I put the calls to the files in the _layout.cshtml file and put the table code in a view. I am getting the following error

Uncaught TypeError: $(...).pqGrid is not a function
    at HTMLDocument.<anonymous> (About:91)
    at l (jquery.min.js:2)
    at Object.fireWith [as resolveWith] (jquery.min.js:2)
    at Function.ready (jquery.min.js:2)
    at HTMLDocument.A (jquery.min.js:2)
(anonymous) @ About:91
l @ jquery.min.js:2
fireWith @ jquery.min.js:2
ready @ jquery.min.js:2
A @ jquery.min.js:2

I have looked through everything online but am unable to find a solution that works. If any one could please help i would be very grateful. Thanks

Pages: [1]