We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Ability to give expand/collapse nodes focus

Hi.

Would it be possible to add the ability to give the expand/collapse nodes focus via the keyboard please?

Thanks for reading.

1 Reply

BM Balaji Marimuthu Syncfusion Team January 26, 2016 09:57 AM UTC

Hi Greg,

Thanks for contacting Syncfusion support.

Yes, we can able to focus the expand/collapse nodes in Grid using the jQuery focus method. Refer to the sample and code example as below.
Sample: http://jsplayground.syncfusion.com/l4tw4v2s



<script type="text/javascript">

       

        $(document).on("keydown", function (e) {

            if (e.altKey && e.keyCode === 74) { // j- key code.

                $("#Grid").focus();  //focus grid

            }


        });

        $("#Grid").on("keydown", function (e) {

            var obj = $("#Grid").ejGrid("instance"), cell;


            if (e.shiftKey) {


                if (e.keyCode == 68) { //shift+D

                    var ele = obj.getContentTable().find("td[class^='e-recordplus']"); //grouping

                    //var ele1 = obj.getContentTable().find("td[class^='e-detailrow']");  //if use detail template or hierarchy

                    $(ele[0]).attr("tabindex", 0);

                    $(ele[0]).focus();

                }

            }

        });
    </script>


Please find the keys to focus expand/ collapse node.

Grid focus
Alt + j
Expand/Collapse node
Shift + d


If you want to perform the Expand and collapse operation using the keyboard, we have a default support. So please refer to the demo and documentation in following link.

Demo: http://js.syncfusion.com/demos/web/#!/azure/grid/KeyboardInteraction

Document: http://help.syncfusion.com/js/grid/accessibility

Regards,
Balaji Marimuthu

Loader.
Up arrow icon