Kendo grid - close addRow and display edit row - kendo-ui

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

Related

How can I deselect all selected option of a dropdown when selecting an option in a different dropdown?

I am having two dropdown menus/ comboboxes on which I can select content which I wanna display on a DataTable.
The first Combobox is called ColorCombo and gets the following options to choose from an Excel sheet:
Sort(Distinct(Table3;Color);Result;Ascending).
The second Combobox is called SizeCombo and gets the following options to choose from an Excel sheet:
Sort(Distinct(Table3;Size);Result;Ascending).
My question is how can I make my code work so that each time I choose a color on one dropdown, then all options from the other dropdown are being deselected? I tried to reset the comboboxes when the onChange even triggered as follows:
ColorCombo onChange : Reset(SizeCombo)
SizeCombo onChange : Reset(ColorCombo)
But this doesn't work because every time I choose a new option then all options from the drop-downs are being unselected because the events trigger each other. Could someone help understand how I could go about it?
If you can only have a value in either one of the drop downs, you could make the onChange variable of each one set the DisplayMode of the other one to Disabled. eg:
ColorCombo onChange : SizeCombo DisplayMode.Disabled
SizeCombo onChange : ColorCombo DisplayMode.Disabled
Sorry if I misunderstood your question!

Kendo Grid - Pop up Editor issue

We are using pop up editor in the Kendo Grid control to edit the record.
My kendo grid has the below extra Controls as below.
Kendo dropdownlist
Div control
Add button
Remove button
A dropdown which has list of values that user will select and press the ADD button which is next to it.
then those values will be added to div control dynamically at runtime.
click on update in the editor, My controller updation action is getting fired.
Now i want to remove the items from the div tag using the Remove button. this time my controller update method is not firing.
I suspect that the changes in div is not firing the change event as the div control items dynamically added and removed.
How can i trigger the change event in the Remove button click function in jquery once i removed the div elements.
Please help me on this, trying this since 2 weaks.

How to hide/show JQGrid inline navigation button from javascript

Hide and show Add and Cancel button programmatically in JQGrid
You can make Add and Cancel button hidden of visible in the same way like any other elements on the HTML page. You can use jQuery.show, jQuery.hide or jQuery.css with "display", "none" or "display", "" parameters. Thus the only thing which you need is to get DOM elements which represent the buttons. You can get the elements by id for example.
jqGrid assigns ids to all standard buttons. The ids of buttons added by inlineNav will be build from grid id as prefix and strings "_iladd" (for Add button), "_iledit" (for Edit button), "_ilsave" (for Save button) and "_ilcancel" (for Cancel button). So if you have the grid with id="mygrid" then $("#mygrid_iladd").hide() can be used to hide the Add button and $("#mygrid_ilcancel").hide() to hide the Cancel button. To hide both buttons you can use $("#mygrid_iladd,#mygrid_ilcancel").hide().

How to prevent auto select row action when in editmode in JQGrid on click of next & prev navigation button on popup

when I doubleclick on the row, it will give edit popup. This edit popup has left and right error key, when I click on that Arrow key , it will select the row in background. so I want to prevent the Auto select row when click of JQGrid Editpopup's Next and previous button.
so when I click on the next button it will select the row in my Grid table.How do I prevent this behavioir? in below image it mention
Please help me. I have tried "onclickPgButtons", but not able to trigger it.
Thanks in Advance.
You can't prevent selection of the new row, but you can just call setSelection with just selected row to unselect it. The code of afterclickPgButtons could be the following
afterclickPgButtons: function (whichButton, $frmgr, justSelectedRowid) {
$(this).jqGrid("setSelection", justSelectedRowid);
}
See the corresponding demo here.

Telerik RadGrid opening an extra popup edit form when pressing "enter" from a popup form for inserting

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">

Resources