Hi,
There is a requirement form client that they dont want to use mouse for adding/editing rows. Is there any built in functionality in igGrid through which we can add new rows/edit existing ones through the keyboard. The editMode for my grid is 'row' .
TAB key does not select the '+Add New Row' button on top of the grid. Is there any built in key bound to the grid for adding new rows & selecting existing ones through the keyboard.
How can I bind custom keys for grid adding/editing fucntionality.
Also how can I disable 'Done / Cancel' buttons without affecting the existing functionality of the grid. I mean will disabling "Done / Cancel" button affect exisiting functionality if autoCommit is set to false.
If possible, please provide MVC helper syntax , I am using MVC Helper for initialization of grid.
Thanks.
Hello Jimmy,
I am glad this helped. Please let me know if you have any other questions on this.
Great, thanks.
Q1 : Solved.
I am glad this helped you resolve your issues. Regarding Question 1:
You can reference the DOM element that hold the row for adding new row and simulate click with jQuery:
$(".ui-iggrid-addrow").trigger("click");
Please let me know if you have any further questions, I will be glad to help.
Hello,
Thanks again.
Q2: Solved.
Q1: Can you tell me how do I trigger the "Add New Row" event. (Just open the editors for add new row, User will enter the column values)
$(document).on("keypress", function () { $("#accSelectionGrid")....???? //+Add new row method? });
Q3: Solved Now.
I tried doing the same like this :
$("#accSelectionGrid").attr("tabIndex", "0");$("#accSelectionGrid").focus();
^ Now when I press up/down arrow key , the whole grid scrolls through its scroll bar, I need to navigate from one row to another using up/down arrow keys. I mean I dont want to scroll the grid rows through its scroller, I want it to navigate from one row to another. Writing the above two lines scroll the whole grid container.
$("#accSelectionGrid_container").attr("tabIndex", "0");$("#accSelectionGrid_container").focus();
^ #accSelectionGrid_container did it.
Regarding the new thread point, I will keep that in mind, though I am only asking grid-keyboard-shortcut queries which the title of the thread suggests.
I hope I am not taking too much of your time, And I am not going to ask any new questions in this thread, just needed some more help on the ones I already asked. Thanks for your help & time , I appreciate it.
Please find answers to your questions below:
Question 1: The "Shift Tab" functionality is somewhat doing the task but it depends on the tab index and all that
Shift + Tab is not part of the keyboard navigation implementation of the igGrid. so it is expected it will not work in all scenarios, such as yours. I just suggested since there is a chance that it does the work for you. All keyboard combinations that are implemented can be found at http://help.infragistics.com/Help/Doc/jQuery/2014.2/CLR4.0/html/igGrid_Accessibility_Compliance.html
If you want to implement your custom shortkeys, you can use the jquery .keypress event and depending on which key is pressed (this can be checked via the browsers key codes) to programmatically enter edit mode of a cell, change selected cell, set focus on a element, etc. Your code shoud be similar to this:
$(document).on("keypress", function () { $("#accSelectionGrid").igGridSelection("selectRow", 0); });
Question 2. How can I specify multiple startEditTriggers in MVC
You separate the different options with | :
.EditMode(GridEditMode.Row).StartEditTriggers(GridStartEditTriggers.Enter | GridStartEditTriggers.F2);
Question 3. How to set focus on Modal's grid programmatically and then use up/down arrow key
You are right, .focus() will not work on elements that are not capable of receiving focus by default. However you can add tabIndex attribute to the DOM element contaning the grid and then it will be able to receive focus using the .focus() method.
I hope this helps. Please note that Infragistics policy is to open a new thread for every different issue that customers have. This makes searching and tracking easier and enables us to provide better support. Please keep this in mind regarding any future issues that you face.