2

I have a Kendo grid in Mvc C# that displays a list of 'jobs'.I put an extra button in this grid that by clicking on that contact information of that job in a Kendo grid as open pop up. But the pop-up does not show anything.and only show Null!! this is my code: Job List in Index.cshtml:

<div>
            @(Html.MyGrid<JobListVm>("grid_job")
            .Columns(c =>
            {
                c.Bound(b => b.Id).Width("6%");
                c.Bound(b => b.CategoryName).Width("15%");
                c.Bound(b => b.JobName).Width("15%");
                c.ViewEditDeleteExtendColumn(d => d.Id,
                    extendColumn: "<button class='k-button' onclick='" + 
     "pageJobIndex3.JobConnectionList(#= Id#);" + "' title='" + "ارتباطات" + "'><span 
      class='k-icon k-i-password'></span></button> ",  
                         viewHandler: "pageJobIndex.view(#= Id#);",
                        editHandler: "pageJobIndex.edit(#= Id#);",
                        deleteHandler: "pageJobIndex.delete(#= Id#);").Width(210);
                })
                .DataSource(d => d.Ajax()
                    .Read(r => r.Action("List", "Job", new {  }).Type(HttpVerbs.Post))
                    .Sort(s => s.Add(a => a.Id).Descending()).Model(m => m.Id(a => a.Id)))
                )
            </div>
    
         <script>
        pageJobIndex3 = {
                JobConnectionList: function (id)
                {
                    var url = '@Url.Action("JobConnections", "Job", new { })' + '/' + id;
    
                    kashi.win.createNewAjaxSimple(
                        "#info",
                        url,
                        function (kashiWindow) {
                            kashiWindow.open();
                        },
                        function (kashiWindow) {
                            var page = kashiWindow.winData.page;
                            var result = page.result;
                            if (result && result.success) {
                               pageJobIndex3.refreshGrid();
                            }
                        },
                        function (kashiWindow) {
                            kashiWindow.destroy();
                        },
                        {
                            width: "30%"
                        }
                    );
                }
            }
    </script>

in JobController:

[HttpGet]
    public JsonResult JobConnections(DataSourceRequest request,int id)
    {
        var list = _jobConnectionService.GetJobConnections(id).ToList();
        var items =list.ToDataSourceResult(request);
        return Json(items);
    }

In JobConnection.cshtml:

    <div>
        @(Html.MyGrid<JobConnectionVm>("grid_jobConnection")
        .Columns(c =>
        {
            c.Bound(b => b.JobName).Width("15%");
            c.Bound(b => b.NConnectionType).Width("15%");
            c.Bound(b => b.ConnectionValue).Width("15%");
            c.Bound(b => b.NCreationDate).Width("15%");
            c.ViewEditDeleteColumn(d => d.Id,
                 viewHandler: "pageJobConnectionIndex.view(#= Id#);",
                editHandler: "pageJobConnectionIndex.edit(#= Id#);",
                deleteHandler: "pageJobConnectionIndex.delete(#= Id#);").Width(170);
        })
        .DataSource(d => d.Ajax()
            .Read(r => r.Action("JobConnections","Job", new { }).Type(HttpVerbs.Get))
            .Sort(s => s.Add(a => a.Id).Descending()).Model(m => m.Id(a => a.Id)))
        )
    </div>
<!--</div>-->
    <script>
     pageJobConnectionIndex = new genPageHandler(
                '#grid_jobConnection',
                '#info',
                "@Url.Action("Create", "JobConnections", new { })",
                "@Url.Action("Edit", "JobConnections", new {  })",
                "@Url.Action("Show", "JobConnections", new {  })",
                "@Url.Action("Delete", "JobConnections", new {  })",
                "500px",
                ""
            );
    </script>

screen shot in my result

Complete the explanations: I get this error in console window:

Failed to set autoNumeric TypeError: $(...).find(...).autoNumeric is not a function
    at Object.numericInputSet (kashi.ui.js:924)
    at Object.createNew (kashi.win.js:395)
    at kashi.win.js:197
    at Object.success (kashi.lib.js:480)
    at i (jquery.min.js:3)
    at Object.fireWith [as resolveWith] (jquery.min.js:3)
    at y (jquery.min.js:11)
    at XMLHttpRequest.c (jquery.min.js:11) n.fn.init(1)

in kashi.ui.js:

numericInputSet: function (inputContainer) {
        try {
            $(inputContainer).find(".auto-numeric").autoNumeric("init", {
                mDec: "0"
            });
        } catch (e) {
            console.log("Failed to set autoNumeric", e, inputContainer);
        }
Mohadeseh
  • 360
  • 4
  • 19
  • So your issue is probably with autoNumeric library. Have you seen this: https://stackoverflow.com/questions/46906684/all-methods-return-autonumeric-is-not-a-function-cant-unformat-numbers – Steve Greene Jul 10 '21 at 15:29

0 Answers0