Telerik Forums
Kendo UI for jQuery Forum
0 answers
106 views

Hello,


I'm using a model popup in which I bind the kendo grid and set the grid right-click to open the context menu. However, the context menu does not appear. I'm using Kendo 2023.2.606 version. Please leave your feedback.

This below same code work fine in normal page. But, it's not working in model popup.

Context menu Code is here:

<ul id="clientSearchGridContextMenu" class="hide">
    <li id="clientSearchGridContextMenuAddFavourite"><span class="menu-item k-link">@Resource.lblAddFavourite</span></li>
    <li id="clientSearchGridContextMenuRemoveFavourite" class="border-bottom-div"><span class="menu-item k-link">@Resource.lblRemoveFavourite</span></li>
    <li id="clientSearchGridContextMenuClose"><span class="menu-item k-link">@Resource.lblClose</span></li>
</ul>

 

JavaScript code for context men:

  bindClientSearchGridContextMenu: function (favourites) {
      clientManagement.variable.clientSearchGridContextMenuAddFavourite.css('display', favourites ? 'none' : 'block');
      clientManagement.variable.clientSearchGridContextMenuRemoveFavourite.css('display', favourites ? 'block' : 'none');

      clientManagement.variable.clientSearchGridContextMenu.kendoContextMenu({
          target: "#clientMatterGrid",
          filter: "tbody > tr",
          open: function (e) {
              clientManagement.variable.clientSearchGridContextMenu.addClass("show");
              let node = $(e.target);
              $("#clientMatterGrid").data('kendoGrid').select(node);
          },
          select: function (e) {
              let node = $(e.target);

              $("#clientMatterGrid").data('kendoGrid').select(node);

              switch ($(e.item).attr('id')) {
                  case "clientSearchGridContextMenuAddFavourite":
                      clientManagement.addRemoveFavourite(true);
                      break;
                  case "clientSearchGridContextMenuRemoveFavourite":
                      clientManagement.addRemoveFavourite(false);
                      break;
                  case "clientSearchGridContextMenuClose":
                      clientManagement.variable.clientSearchGridContextMenu.data("kendoContextMenu").close();
                      break;
              }
          }
      });
  }

 

Hemanshu
Top achievements
Rank 1
 asked on 12 Dec 2023
0 answers
311 views

Hi Guys,

 

I have JQuery, KendoUI ASPNET MVC 5 which has two pages Index and View Details Page each has a dedicated js file and want to return to the previous Grid page number when a button in View Details is clicked:

  • In the first page I search Customer details which populates a table with Customer details { Name, Occupation and Title, a link to the view details} and has pageSize of 10 and multiple pages, depending on the customers stored.
  • What I want to achieve is to be able to return to the previous page results that was selected when and <a> to view details was clicked. For Instance I click <a> element on page number 20, I want to return to page 20 when I click save.

This is what I have tried so far:

  • I used the standard way of saving the page grid in a sessionStorage , retrieving the saved page and assigning it to the current page when save or cancel button is clicked, and assigning the saved grid page number using this method:    kendoGrid.dataSource.page(savedPage).
    • Results:  Returns to the first of results, irrespective of the current save page in the session storage.

    I then attempted to fix the issue by trying to set the page number using the jquery.

    ViewDetails.js

    $(document).ready(function () {

      $("button.isa-button-back, button.isa-button-save").click(function (e) {
        localStorage.setItem("depositButtonClicked", true);
      });
    });

    Index.js

    $(document).ready(function () {
      var filterNumber = $("span.k-state-selected").text();
      localStorage.setItem("filterNumber", filterNumber);
      if (localStorage.getItem("depositButtonClicked") === "true") {
        var storedValue = localStorage.getItem("filterNumber");
        $($("ul.k-pager-numbers li span.k-state-selected")).removeClass(
          "k-state-selected"
        );
        $("ul.k-pager-numbers li span")
          .filter(function () {
            return $(this).text() == parseInt(storedValue);
          })
          .addClass("k-state-selected");
        localStorage.removeItem("storedValue");
        localStorage.removeItem("depositButtonClicked");
      }
    });

    Results: Internal Server Error 500, when I click save or back button in the detailsPage

    Another way that I tried was to use this function in the  CustomerController's method:

             
        public ActionResult Back()
        {

            SetScriptModuleOptions("IndexModule", new { RestoreGrid = true });
            SetScriptModuleOptions("IsaSearchGrid", new { PreserveGridState = GridStatePreservation.All });

            return RedirectToAction("Index");
        }

Moshele
Top achievements
Rank 1
 asked on 14 Feb 2023
0 answers
1.2K+ views

I am working with kendo grids with buttons in each column that display another grid in a modal. The first is using MVC, the modal grid was created dynamically. Each uses kendo dropdownlists to edit cells. The issue occurs like this:

1. A dropdownlist is clicked on in the initial grid,

2. The modal is opened afterward (each row has its own button)

3. A dropdownlist inside the modal's kendo grid is clicked, and nothing happens

Basically, if a dropdown is clicked in grid 1, and then you attempt to click one of the dropdownlists in the modal grid, 
this error is thrown:

Uncaught TypeError: m is not a function
    at init.editor (kendo.all.min.js:54)
    at init.refresh (kendo.all.min.js:54)
    at new init (kendo.all.min.js:54)
    at HTMLTableCellElement.<anonymous> (kendo.all.min.js:26)
    at Function.each (jquery.min.js:2)
    at R.fn.init.each (jquery.min.js:2)
    at R.fn.init.e.fn.<computed> [as kendoEditable] (kendo.all.min.js:26)
    at init.editCell (kendo.all.min.js:59)
    at init.tap (kendo.all.min.js:59)
    at init.trigger (kendo.all.min.js:25)

This error is vague, and on the surface seems like jQuery scripts may be interfering or out of order. I don't think this is the case
because A) I haven't recieved errors like this before and B) the dropdowns work if the modal is opened without any of the dropdowns in the
other grid being touched. It seems as if when a dropdown is clicked in initial grid, somehow it breaks the dropdown in modal grid. They
do not have the same name.

Any ideas on where this console error comes from?

Here is a snippet of the grid being generated in the modal:

 $("#account-tracking-grid").kendoGrid({
        columns: [
            {
                field: "accountName",
                title: "Account Name",
                editable: function () { return false },
                width: "200px",
            },
            {
                field: "accountNumber",
                title: "Account Number",
                editable: function () { return false },
                width: "200px"
            },
            {
                field: "Balance",
                title: "Balance",
                width: "40px",
                template: "<span>#=getIcon(Balance)#</span>",
                editor: dropdownlist,
                headerTemplate: "<span class='verticalText'>Balance</span>"
            }
 ],
        editable: "incell",
        edit: function (e) {
            var container = e.container;
            var dropDownList = container.find("[data-role=dropdownlist]").data("kendoDropDownList");
            if (dropDownList) dropDownList.open();
        },
        dataSource: {
            transport: {
              read: "/Account/Tracking?uniqueId=" + document.getElementById('unid').value
            }
        }
    });
}

function dropdownlist(container, options) {
    $('<input id="account-dropdownlist"/>')
        .appendTo(container)
    $("#account-dropdownlist").kendoDropDownList({
        dataTextField: "text",
        dataValueField: "value",
        dataSource: items,
        change: onChange,
        open: onOpen
    });
}

Peter
Top achievements
Rank 1
 updated question on 07 Jun 2021
0 answers
61 views
Hello,
I my application , i use a modalview  and  there is a listview insdie the modal view .  I need to open Popover when click that  listview item.  
 I can open  POPover  but problem is Popover is not  displayed . 

Thank you.
Poorna
Top achievements
Rank 1
 asked on 09 Nov 2012
0 answers
64 views
hello all. Use kendo ui Mobile with great satisfaction! is very powerful.
But I have a problem I can not solve.
how can I get these links?


<a href="#link.html?id=1">
<a href="#link.html?id=2">
<a href="#link.html?id=3">


when calling a link works fine, but quanro recall another link, the page is blank.
while if I need to refresh the page is loaded correctly.
please help me.
Angelo
Top achievements
Rank 1
 asked on 25 Oct 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?