Telerik Forums
Kendo UI for jQuery Forum
0 answers
55 views

I have a Kendo grid Jquery component with field grouped and hidden. I would like to show a filter button based on this field. Could you help me ?

Thanks

Alex
Top achievements
Rank 1
 asked on 16 Feb 2023
0 answers
333 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
95 views

greetings.

I drew a line chart where the x-axis is the time value and the y-axis is the number.
How can I highlight (or select) the place corresponding to the time axis of the line chart by clicking the time text link outside the chart?

 

thank you for answer.

 

hans
Top achievements
Rank 1
 updated question on 13 Feb 2023
0 answers
226 views

I have a parent kendo grid which has a detail kendo grid with a custom template. The custom detail template includes a tab strip with two tabs. Each tab includes a single kendo grid. I am using the default create and edit kendo grid buttons with some custom text. The controls on the parent grid seem to be working normally. When I press "Add New Row" a kendo editor pops up (pop up editing enabled) and in the background I can see that a new row is created. However, on two detail grids which are contained within each of the two tabs it seems that the pop up create and edit functionality is not working correctly. A window is popped up and the editing/creating actually works, but the grid acts strangely - mainly when I press the cancel button to exit out of an "edit" event for a particular item in one of the detail grid rows. 

I believe that I have included the appropriate amount of code to look into the issue. 

Thanks for the help! 

<div data-ng-controller="GridCtrl as gridCtrl"><script type="text/x-kendo-template" id="detail-grid-template"> <div class="detail-tab-strip"> <ul> <li class="k-active"> Grid One </li> <li class="k-active"> Grid Two </li> </ul> <div> <div class="grid-one"></div> </div> <div> <div class="grid-two"></div> </div> </div> </script><script type="text/x-kendo-template" id="grid-one-editor"> <div> <ul class="fieldlist"> <li> <label for="GridOneID">ID</label> <input type="text" class="k-input k-textbox full-width k-state-disabled" disabled="disabled" name="GridOneID" data-bind="value:GridOneID"> </li> <li> <label for="GridFieldOne">One</label> <input type="text" class="k-input k-textbox full-width" name="GridFieldOne" data-bind="value:GridFieldOne"> </li> <li> <label for="GridFieldTwo">Two</label> <input type="text" class="k-input k-textbox full-width" name="GridFieldTwo" data-bind="value:GridFieldTwo"> </li> <li> <label for="GridFieldThree">Three</label> <input type="text" class="k-input k-textbox full-width" name="GridFieldThree" data-bind="value:GridFieldThree"> </li> <li> <label for="GridFieldFour">Four</label> <select id="GridFieldFour" name="GridFieldFour" data-bind="value:GridFieldFour"></select> </li> <li> <label for="GridFieldFive">Five</label> <select id="GridFieldFive" name="GridFieldFive" data-bind="value:GridFieldFive"></select> </li> </ul> </div> </script></div>

 


function gridOneCreateOrEditEvent(e) {

	var detailGridWrapper = this.wrapper,
		mainGrid = $("#parentGrid").data("kendoGrid"),
		$parentGridTr = $(detailGridWrapper).closest("tr").prev(),
		parentData = mainGrid.dataItem($parentGridTr);
	
	e.model.set("GridOneID", parentData.get("GridOneID"));
	e.model.set("GridFieldFive", parentData.get("GridFieldFive"));

	if (e.model.isNew()) {
		e.container.kendoWindow("title", "Create Item");
	}
	else {
		e.container.kendoWindow("title", "Edit Item");
	}

	$("#GridFieldFive").kendoDropDownList({
		dataSource: vm.fieldFiveOptions,
		change: function (c) {

			var dropDownValue = $('#GridFieldFive').data("kendoDropDownList").value();
			e.model.set("GridFieldFive", dropDownValue);

			this.value(dropDownValue);
		}
	});

	$("#GridFieldFour").kendoDropDownList({
		dataSource: [
			{ id: "A", name: "B" },
			{ id: "B", name: "B" }
		],
		dataTextField: "name",
		dataValueField: "id",
		change: function (c) {
			var dropDownValue = $("#GridFieldFour").data("kendoDropDownList").value();
			e.model.set("GridFieldFour", dropDownValue);

			this.value(dropDownValue);
		}
	});

	if (e.model.get('GridFieldFour') === 'A')
		$('#GridFieldFour').data("kendoDropDownList").value('A');
	else {
		$('#GridFieldFour').data("kendoDropDownList").value('B');
		e.model.set("GridFieldFour", $('#GridFieldFour').data("kendoDropDownList").value());
	}

	var popupWindow = e.container.data("kendoWindow");
	popupWindow.setOptions({ width: "600px" });
	popupWindow.setOptions({ height: "700px" });
	popupWindow.center();
}

function detailInit(e) {
	var gridOneToolbar = [];
	var gridOneCommands = [];
	var detailRow = e.detailRow;

	gridOneToolbar = [
		{ name: "create", text: "Add New Entry" }
	];

	gridOneCommands = [
		{ name: "edit", text: { edit: "Edit", update: "Save" } },
		{ name: "Delete", iconClass: "k-icon k-i-close", click: showGridOneDeleteConfirmation }
	];


	detailRow.find(".detail-tab-strip").kendoTabStrip({
		animation: {
			open: { effects: "fadeIn" }
		}
	});

	detailRow.find(".grid-one").kendoGrid({
		dataSource: {
			transport: {
				create: createItem,
				read: readItems,
				update: updateItem,
				parameterMap: function (options, operation) {
					if (operation !== "read" && options.models) {
						return { models: kendo.stringify(options.models) };
					}
				}
			},
			batch: true,
			pageSize: 10,
			filter: [
				{ field: "GridOneID", operator: "eq", value: e.data.GridOneID },
				{ field: "GridFieldFive", operator: "eq", value: e.data.GridFieldFive }
			],
			schema: {
				data: "Data",
				total: "Data.length",
				errors: handleGridErrors,
				model: {
					id: "GridOneID",
					fields: {
						GridOneID: {
							editable: true,
							defaultValue: e.data.GridOneID
						},
						GridFieldOne: {
							editable: true
						},
						GridFieldTwo: {
							editable: true
						},
						GridFieldThree: {
							editable: true
						},
						GridFieldFour: {
							editable: true
						},
						GridFieldFive: {
							editable: true
						},
						RowStatus: {
							editable: false, validation: { required: false }
						},
						RowMessage: {
							editable: false, validation: { required: false }
						}
					}
				}
			}
		},
		scrollable: false,
		sortable: true,
		pageable: {
			refresh: true
		},
		toolbar: gridOneToolbar,
		columns: [
			{ title: "", width: "40px", template: $('#grid-row-status-template').html() },
			{ field: "GridOneID", title: "ID", width: "100px" },
			{ field: "GridFieldOne", title: "One", width: "70px" },
			{ field: "GridFieldTwo", title: "Two", width: "40px" },
			{ field: "GridFieldThree", title: "Three", width: "40px" },
			{ field: "GridFieldFour", title: "Four", width: "50px" },
			{ field: "GridFieldFive", title: "Five", width: "60px" },
			{
				command: gridOneCommands,
				title: "&nbsp;", width: "180px"
			}
		],
		edit: gridOneCreateOrEditEvent,
		editable: {
			mode: "popup",
			template: kendo.template($("#grid-one-editor").html())
		}
	});
}


 

 

Chris
Top achievements
Rank 1
 updated question on 09 Feb 2023
0 answers
71 views
jQuery Grid Row Template can't escape from the bondage of row.
jQuery Grid Row Template works only in row units.

However, ListView is nice because it allows you to put multiple divs on a single line.

I've done a lot of development with KendoGrid. I want the already created KendoGrid to behave like a ListView.
I need a template like ListView inside a Grid. Is it difficult to make?
Grid and ListView are very similar. I hope that the already developed Grid will be like ListView with a simple template function.
Converting an already developed Grid to a ListView takes too much effort. that's insane It should be resolved in Progress.

Or, is there already a way?

thank you.
n/a
Top achievements
Rank 1
Iron
Iron
 asked on 26 Jan 2023
0 answers
217 views

I am working on a page that has a table set to display: none and I want to have the Kendo UI Grid initialize its data set from this table. Unfortunately I am seeing that this does not work properly when the table has style=display: none as an attribute. In this situation I see the Grid's column headers render, but no rows are shown. Of course simply removing the display none style would fix the problem, but the table is several thousand rows and we have it hidden to increase page load performance.

Is there a way I can initialize the Kendo UI Grid from this hidden table, then show the grid afterwards?

DuelingCats
Top achievements
Rank 2
 asked on 15 Jan 2023
0 answers
75 views

Hello, dear colleagues.

I'd like to know, is there any approach to programmatically change grid's active page after calling dataSource.read transport method?

If I use dataSource.page(x), I'm having an infinite call chain.

I dont want to call dataSource read, my data is okay. I'd like to change grid's visual pager only, like "page 7 of 100".

 

Thank you.

 

 

 

 

 

 

Max
Top achievements
Rank 1
 updated question on 15 Jan 2023
0 answers
75 views

I am resetting the grid's state like this:


        const $grid = $gridRoot.find('.xifacts-simple-grid');
        const grid = $grid.data('kendoGrid');
        grid.dataSource.filter({});
        grid.dataSource.sort({});
        grid.dataSource.pageSize(5);
        grid.clearSelection();
        grid.dataSource.page(1);

All is good, the grid state is correctly reset (it goes to page 1) - but it still shows the old page that was selected.

Same for the Items/Page.

 

Here is a gif for the issue:

iFACTS Admin
Top achievements
Rank 1
 asked on 10 Jan 2023
0 answers
108 views

we have a field in which the source value is an array of objects, to edit it we use kendoMultiSelect, to show we just concat the values:

 


this.MultiSelectEmployeeClassesArrayToString = function (item) {
            return item.EmployeeLicensingClasses
                .map(function (employeeClass) { return employeeClass.Description; })
                .join(', ');
        },

is there a way to make filtering work as a contains for example & sort just the value we display (concatenating)?

 

Aleksandr
Top achievements
Rank 1
Bronze
Bronze
Veteran
 asked on 28 Dec 2022
0 answers
147 views

Hi,

When I tried to filter the grid by pressing the buttons on top of the grid, the filtering does not appear to work.

I just dont know where I went wrong. I have done quite a few of them without issues, but on this one, i cannot see where the problem is. I have now triple check the code and I still can't see it!

Adding here a link to the dojo: https://dojo.telerik.com/@galedin/EXAZIJIx

 

Thanks,

 

 

Monica
Top achievements
Rank 1
Iron
 updated question on 20 Dec 2022
Narrow your results
Selected tags
Tags
+? more
Top users last month
Patrick
Top achievements
Rank 1
Iron
Iron
Iron
MIS
Top achievements
Rank 1
Ross
Top achievements
Rank 1
Marcin
Top achievements
Rank 1
Iron
Iron
Sean
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Patrick
Top achievements
Rank 1
Iron
Iron
Iron
MIS
Top achievements
Rank 1
Ross
Top achievements
Rank 1
Marcin
Top achievements
Rank 1
Iron
Iron
Sean
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?