Telerik Forums
Kendo UI for jQuery Forum
0 answers
92 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
298 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
1 answer
48 views

Hi, I just came into contact with Kendo UI. I think it is very powerful, especially the function of MVVM is very easy to use.

I have a question that I haven't understood. After setting the data of the datasource, you can operate on it, but the schema.model property can set the information of the data field. Is this unnecessary?

I never know the relationship between datasource and schema. Model. It seems that I don't set schema. Model and datasource works normally.

Can any engineer explain their specific links and functions? Thank you for your help.

 

Martin
Telerik team
 answered on 05 Oct 2021
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
3 answers
231 views
I've noticed that with ModalView in the Beta (kendoui.2012.2.621.beta.trial) it doesn't work both in example or via demo code.

That is to say, you see the modal in full display (ie doesn't initially show it hidden). When You also click on the Login button you get the following error:

  1. Uncaught TypeError: Cannot read property 'nextView' of undefined kendo.mobile.min.js:8
    1. h.extend.replacekendo.mobile.min.js:8
    2. c.Observable.extend.navigatekendo.mobile.min.js:8
    3. c.Observable.extend._findViewkendo.mobile.min.js:8
    4. c.Observable.extend.navigatekendo.mobile.min.js:8
    5. c.Observable.extend._startHistory.e.changekendo.mobile.min.js:8
    6. A.extend.triggerkendo.mobile.min.js:8
    7. c.Observable.extend.navigatekendo.mobile.min.js:8
    8. f.event.dispatchjquery.min.js:3
    9. f.event.add.h.handle.ijquery.min.js:3

Petar
Telerik team
 answered on 28 Sep 2020
2 answers
29 views

Hello,

 

I have a Kendo UI Mobile ModalView that I use as a message dialog. It is rather simple (html code below),

and used to work fine by calling open and close methods and changing view data in between.

Now I have a situation where the modal view is already open and needs to be closed and

immediately reopened again with new data. It goes like this:

$("#modalview-alert").data("kendoMobileModalView").close();

changeSomeAlertData();  // update title and message text

$("#modalview-alert").data("kendoMobileModalView").open();  // opens view but immediately closes it

However the view doesn't reopen, apparently previous close method closes it too.

I tried to put a delay around close and I see that the view is reopened but immediately

closed after delay expires. Later on reopen works OK, this problem only happens if

open is done immediately after close. How can I close and immediately open the modal view again?

Thanks.

 

ps I use it on Android 7.0, Samsung Internet.

 

Regards,

Oleg

    <div data-role="modalview" id="modalview-alert" data-close="onModalViewAlertClose">
        <div data-role="header">
            <div data-role="navbar">
                <span id="modalview-alert-title"></span>
                <a data-click="closeModalViewAlert" data-role="button" data-align="right">X</a>
            </div>
        </div>
        <div id="modalview-alert-body" style="position: relative">
            <div id="modalview-alert-message"></div>
        </div>
        <div data-role="footer">
            <div id="modalview-alert-buttons" data-role="navbar"></div>
        </div>
    </div>
Oleg
Top achievements
Rank 1
 answered on 10 Jul 2018
8 answers
157 views
The following sample is self explanatory and I would be surprised if it were by design:
<!DOCTYPE html>
<html>
<head>
    <title></title>
    <script src="http://code.jquery.com/jquery-1.8.2.min.js" type="text/javascript"></script>
    <script src="http://cdn.kendostatic.com/2012.3.1114/js/kendo.all.min.js" type="text/javascript"></script>
</head>
<body>
<div data-role="view">
    <a data-role="button" href="#foo" data-rel="modalview">This triggers logTarget</a>
    <a data-role="button" data-click="open">This does not trigger logTarget</a>
    <div id="console"></div>
</div>
<div data-role="modalview" id="foo" data-open="logTarget">
    This is a simple modal view
</div>
<script>
    $(function(){
        new kendo.mobile.Application();
    });
 
    function open(e) {
        var modalView = $('#foo').data('kendoMobileModalView');
        modalView.open();
    }
 
    function logTarget(e) {
        $('#console').append('logTarget Triggered');
    }
</script>
</body>
</html>
Nencho
Telerik team
 answered on 06 Oct 2017
1 answer
395 views

Hi,

With reference to using component with dialog service (http://www.telerik.com/kendo-angular-ui/components/dialog/service/#toc-usage), I have a form inside the component and I would like to submit the form and close the modal using a button from inside the component rather than using the action buttons.

How should I go about achieving that?

Please refer to the following plunker: 

http://plnkr.co/edit/Qq50UCo0jTaqUBYI4hq3?p=preview

Thanks.
Alex Gyoshev
Telerik team
 answered on 31 Aug 2017
3 answers
2.9K+ views

Hello,

i have a feature request for Kendo UI for Angular 2. It would be nice to have possibility to create dialogs without 'x' in the top right corner. For example if one wants to create a confirmation dialog hat only has 'yes'/no  buttons that user has to choose from, without possibility to dismiss dialog with 'x'.

Dimiter Topalov
Telerik team
 answered on 09 Aug 2017
Narrow your results
Selected tags
Tags
+? more
Top users last month
Dominik
Top achievements
Rank 1
Giuliano
Top achievements
Rank 1
Dominic
Top achievements
Rank 1
Glendys
Top achievements
Rank 1
NoobMaster
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Dominik
Top achievements
Rank 1
Giuliano
Top achievements
Rank 1
Dominic
Top achievements
Rank 1
Glendys
Top achievements
Rank 1
NoobMaster
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?