Kendo UI - Click Grid Row to Populate Another Grid - kendo-ui

I have a Kendo grid that when you click on a row, I would like it to update the contents of another grid on the page. How would you write a function to tell the grid to update the second grid? As an example, the first grid would be a list of states and the second grid would show all of the cities within the selected state.

Just bind the click event on the rows of your first table :
$("#states tbody").on("click", "tr", changeState);
and then change the data of your second table accordingly :
$("#cities").data("kendoGrid").dataSource.data(getListOfCities());
Here is just some sample code : jsFiddle

Related

Jqgrid - How to display selected rowdata of first grid in vertical columns in second grid

I have a situation where if I select the row of first grid its header and values should be vertically assigned in second jqgrid. I was able to get the rowdata from onselectrow but how should I pass this to second grid and display them vertically.
If anyone have any idea about how to achieve it ..I will really appreciate...Thanks!

Showing another grid inside one cell of the kendo grid

I am using a kendo grid to display my data. I want to show another kendo grid inside one cell of my kendo grid. Is there anyway I can achieve this?
There is a 'way' (using the "template" option of the corresponding Grid column), however I would suggest to instead use Grid hierarchy to show details about current row:
Grid: hierarchy demo
Nesting another Grid inside cells of current Grid is not a good idea as it will not be usable, it will reduce the page performance etc.

Mark newly added row in Kendo UI Grid

I have a situation that user go to page with Kendo Grid and he can add new item to this Grid. Before he refresh page - new items are visible at the top of the Grid (stantard Kendo UI way)
I want to mark newly added rows, for example I want to have them shown in different colour than the "old' ones.
Is is possible to do this?

Pop up a custom form with custom data on click of a cell in jqgrid

I have a grid control displaying data about a Company. I want one column to be "Employee". On click on the any cell of "Employee" column I want to pop up the one Form called "Employee Details" and would like to feel the data.
How can I do this?
As I understand the modal form on click of a jqgrid cell deals with data only related to that row. I want to show different data on the pop up form, i.e. other than the grid data.
Pl help.
Shivali
Probably you can use unobtrusive links in the column (see this and this answers). The advantage of this technique is that instead of typical links you can define any custom action on click on the link. The look of the link can be defined by CSS, but it seems to the that the link can show the user better as other HTML elements, that the user can click on it.
Alternative you can use a button in the column with respect of the custom formatter, but with the same technique as described before you can free define which action will be done on the click.
Inside of the click event with the parameter 'e' you have e.currentTarget as the DOM element of <a> for the link or <input> or <button> if you use buttons in the grid column. To find the row id you can use var row = $(e.currentTarget).closest("tr.jqgrow") or var row = $(e.target).closest("tr.jqgrow") to find the <tr> element. The row id will be row[0].id.

jqgrid add new row - pre-filled

I use two grids at one PHP page.
Is there any way to get data from the first grid (i.e. after click row) and pre-fill it into the add new row form in the second grid?
thank you for any suggestion Petr
I am not sure that I correct understand what you mean under the "pre-filling". But how I understand you question you can do following:
With respect of onSelectRow event which you define on the first grid you will receive the id of selected row as the parameter. Inside of the onSelectRow event handle you can call getRowData to get full information about the data of selected row. Then using addRowData for example you can add new row in the second grid.

Resources