SlickGrid best Way to Up/Down Row with cell button - slickgrid

I search an issue to up/down row with buttons.
I m trying to use 'grid.getCurrentCell' but when i click button currentCell is not yet define.
How can i do this ?
Thanks.
(sorry for my poor english)

You can probably do this using the ID of your row. When you create the row, set the button to
<a onclick='moveUp(23)'><img src='up.gif'></a>
Where 23 is the index in your data. You could also update this by calling:
for(var i in data)
data[i]['upButtonColumn']="<a onclick='moveUp("+i+")'><img src='up.gif'></a>";
grid.removeRows(rows);
grid.render();
Or something similar, but that would be slower.

Related

How to collapse/expand all subgrids of same level when clicking on first column

I would like to expand or collapse all subgrids when I click on the first column (yellow) under the selected row.
Plz see pictures below :
and I would like to add some icon in this column.
I've tried with this code in onSelectRow event :
jQuery(this).closest("tr.ui-subgrid").find("td.ui-widget-content:first").append('<span class="ui-icon ui-icon-plus"></span>');
but without success.
Many thanks for anybody who could help me.
Have a nice day
Cheers
Jihel
Many thanks Oleg for your kind help.
Therefore, I think I have not fine explained my trouble.
So, I have updated pictures for focusing my wish.
Your old answer allows to expand/collapse all rows in a grid, but that I would want is to expand/collapse all subgrids from one row at a time, and set a plus/minus icon in the first column under the selected row which trigger click event for expanding/collapsing subgrids.
If my request is not clear, plz let me know.
And many thanks to helpers.
Regards
Jihel

Kendo Hierarchy Grid clear selection

I am playing with this example by Kendo: http://dojo.telerik.com/EneFe
I have modified it so that the rows are selectable (selectable:true).
I have added a button on the top which calls the grid.clearSelection() function.
This is supposed to clear all selection but it does not clear the selection of rows that are selected in the dropdown table. (Recreate: click on the first row "Nancy", expand it and click on "10258 - Austria", then click the "Clear Selection" button and only "Nancy" will clear)
Is the function not working properly or am I misusing it?
In any case - how can I achieve a total clearing of all selected rows?
This is because they are two separate grids. Check this:
http://dojo.telerik.com/EneFe/2

Kendo UI Batch Grid Edit Cell when not in Editor Template

I turn to you stackoverflow!
I'm using a kendo ui batch grid with InCell editing set and am wanting to know a way to set a particular column into edit mode.
I've tried using editCell, and so far it hasn't caused any of the cells to go into edit mode :(
In this particular case, we have a ClientTemplate column specified which has a button (really its a link...) in it. When the user clicks the button I would like a particular cell in that row to switch to edit mode. For reference here's what the specific column template looks like:
columns.Template(t => { }).HeaderTemplate("")
.ClientTemplate(#"
<a href='javascript: void(0)' class='abutton SecondaryActiveBtn' onclick='editVariableRate(this)' title='Edit'>Edit</a>")
.Width(100).Title("");
Here is the particular javascript method that gets called on the button click:
function editVariableRate(element) {
grid = $("#variableFee").data("kendoGrid");
var cell = $(element).closest("tr").find("td:eq(2)");
grid.editCell(cell);
}
Am I doing something wrong here because the particular column never goes into edit mode?
For reference, I can do the following successfully using the same "cell" variable:
var cellIndex = grid.cellIndex(cell);
and cellIndex gets assigned correctly, so I don't think its a problem of selecting the particular cell...
Anybody have any ideas?
Figured it out! It was the link that was the cause of the problem :( Swapping that to be an input button was the only thing that was needed. bangs head into desk.

jqgrid: using setselection as if the user clicked on the row?

I have a grid (master/detail) with keys bound. I'd like to have the first row in the master grid automatically selected when the page starts.
I used setSelection in the GridComplete event and can get the row selected. However, the up/down arrows (and the detail grid) do not function until the user actually clicks on a row with the mouse.
Does anyone have any ideas about how to get a row selected programatically so that the grid operates as if the user had clicked the row?
Thanks,
-Bill
The problem is that the grid does not have focus, so keyboard commands are not routed to it when the grid is initially displayed. You can work around this by explicitly calling focus after setting your initial selection:
jQuery("#myGrid").setSelection(myID).focus();

How to implement a Chained menu in PHP?

I want to have a AJAX Function of implementing a chained menu + a result table.
What i need to do:
Firstly, the page populate automatically a vertical menu from MySQL and a result table.
Secondly, when i click an item in the menu, it displays a submenu in a fixed area in the page and a new result table.
Thirdly, when i click an item in the submenu, it displays a sub-submenu in another fixed area in this page and a new result table.
Last, when i click an item in the sub-submenu, it displays a result table.
All the result tables are in the same position. It changes depending on the click in the menus.
I'm lost in how to do that. Do you any ideas about how to implement this? Thanks so much.
Edit:
The effect is a little like this: effect
Your First, Second, Third, Last very much looks like visualjquery.com
I believe it is written in Javascript+jQuery, so you could learn from its source.

Resources