I have this example:
http://dojo.telerik.com/IhEdu
There is column CanDelete in data to hide/show "delete" command column. Column is removed in dataBound based on CanDelete value.
Now try to click on "edit" text in grid then "cancel" in popup dialog. And "delete" appears right of "edit". But this column has been deleted on dataBound.
It has something to do with schema, because removing schema fixed this. Why? What's wrong with this schema definition?
Thnx for help
I think the row gets rebuilt when the dialog closes.
Try replacing the commands and the dataBound handler with a CanDelete template
{
field: "CanDelete",
template: "<a class='k-grid-edit'> edit </a> #if(CanDelete){#<a class='k-grid-delete'> delete </a>#}#"
}
http://dojo.telerik.com/IhEdu/10
Related
I have grid, with inline edit function. When I click to Add Record button, new editable row is displays. When i click on edit button in another row, the add row is cenceled and I must click again on edit button.
So, I must click twice on edit button if I befere clicked to Add Record button. It is possible to edit row in one click maybe in Grid Edit event ?
#(Html.Kendo().Grid<TT.Web.Models.ViewModel.WorkViewModel>()
.Name("gridAdd")
.Events(events => events.Edit("gridEdit").DataBound("databoundinitAdd").Save("gridAddSaveChanges"))
Maybe:
function gridEdit(e){
$(".k-grid-cancel").click(); // remove ADD record ROW (no work)..
Thanks
The only solution that I can think of currently is to define custom buttons with custom "click" event handlers for the "cancel", "update" and "edit" commands. For your convenience I created small example which you can use as baseline to achieve the desired behavior:
http://dojo.telerik.com/EqOmU/3
This example from Oleg is very close to the behavior I'm looking for (the first button) but I want preserve whether or not it was highlighted if possible, and don't want to highlight a row and check on the check box if it was un-selected. Just to clarify, I will be popping a modal dialog if they click this button, it has nothing to do with editing the row.
http://www.ok-soft-gmbh.com/jqGrid/Admin3.htm
Thank you,
Stephen
To prevent highlighting of the row in which the custom button will be clicked one need just include return false; inside of click event handler:
click: function(e) {
alert("'Custom' button is clicked in the rowis="+
$(e.target).closest("tr.jqgrow").attr("id") +" !");
return false; // !!!!!
}
The demo demonstrate the results. It's the updated version of the demo from the answer and the previous one which you referenced in your question. Additionally I updated the code of myDelOptions.onclickSubmit based on the code from the answer.
i think i found a strange bug in jqGrid.
If you click on this link you can see a jqGrid with a pager. If you click on the '+' button you get the add form in which the 2 datepickers work as expected.
If you now click on this link you can see the very same table, and the very same add button. Anyway if you try to set the second date using tha datepicker you will notice that the focus moves back to the first input, opening the first datepicker.
The example does not work because it has the first field (Id) hidden, so the real first field is a datepicker. Moreover, the edit form is modal.
Last, if you click in this link the behaviour is correct even if the first field is a datepicker. The only thing i changed is the modal property (to false, before it was true).
However, i NEED to hide the Id field AND have a modal window, so i have to to get rid of this problem...
Can someone suggest a solution or an hint?
Thanks
PS: notice that if you set modal: false, you still get the black/transparent overlay like if the window is modal BUT it is not! If you click outisde the edit form it will be closed. This is not acceptable for my requirements.
try to set jqModal parameter into false
var editParams = {
modal: true,
jqModal:false,
... //other options you need
}
grid.editGridRow(row_id, editParams);
for more information see answer Oleg's analisys
I try to implement the link from one grid to the modal dialog of another grid. I made an example
to illustrate this problem. If you choose in a context menu (right mouseclick) of each row of the picture grid, you will find some Actions. One of them is "Go to scan info". Here I would like to have a link to modal dialog of grid "Scans" and modal dialog should put the user depending whether the scan record for the selected picture allready exist or not, to the Add/Edit modal dialog.
Does anybody already implemented something like that?
Let us we have two grids on one page: one with id="grid" and another with id="scan". Exactly like you call jQuery('#grid').jqGrid('editGridRow',id) on double-click on the first grid you can call jQuery('#scan').jqGrid('editGridRow',id) in the context menu "Go to scan info". The only thing which you have to know is to know the ids on the second grid. Before calling of jQuery('#scan').jqGrid('editGridRow',id) you can impelemt any additional logic (like testing whether "the scan record for the selected picture allready exist or not").
If I understand, you need insert another jqgrid into modal dialog. Did you try to insert jqgrid function into open event of jquery dialog?
You have to call jqgrid function on demand, not in document.ready statement in this case.
Imo this could work (not tested yet):
$( ".selector" ).dialog({
open: function(event, ui) {
$("#grid").jqGrid({
... all of options...
});
}
});
I have a radgrid that uses the popup edit mode with a custom edit template. The edit form upon pressing the enter key will insert a new item into the grid. I go in and add an item. This successfully inserts. Then I go to add a second item: The popup form appears. I enter in my data and press the "enter" key to insert the item. This time, instead of inserting the item, my edit form will clear out the data I entered and open another popup edit form to allow editing of my previously inserted item (from the first time). I now have 2 popups (1 for inserting, 1 for updating).
If I click the insert button instead of pressing "enter", then everything works ok. From what I can guess is that it is thinking that I'm pressing the enter on a selected row on the grid. How do I prevent it from triggering the "edit" event while I'm trying to insert?
Thanks
Try adding a panel to the edit template and set the DefaultButton to your Insert button.
<asp:Panel ID="pnlEditor" runat="server" DefaultButton="btnUpdateItem">