jQWidgets Forums

jQuery UI Widgets Forums Grid jqxGrid('focus') does not work in Chrome

This topic contains 3 replies, has 2 voices, and was last updated by  Peter Stoev 11 years, 5 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • jqxGrid('focus') does not work in Chrome #50079

    alex_svs_fl
    Participant

    Hello,
    I need to select one cell of the grid when page is loaded.
    I use the code

    
     (function ($) {
    var dataUrl = '@Url.Action("GetCityData")';
            var gridSelector = "#cityGrid";
            $(document).ready(function () {
                var source = {
                    datatype: 'json',
                    dataFields: [
                        { name: 'id', type: 'Number' },
                        { name: 'name', type: 'String' },
                        { name: 'population', type: 'Number'},
                        { name: 'year', type: 'Number' },
                        { name: 'country', type: 'String' }
                    ],
                    url: dataUrl,
                    id: 'id'
                };
    
                var dataAdapter = new $.jqx.dataAdapter(source);
    
                $(gridSelector).jqxGrid({
                    source: dataAdapter,
                    selectionmode: 'singlecell',
                    theme: 'classic',
                    columns: [
                        { text: 'Name', dataField: 'name', width: 150 },                    
                        { text: 'Foundation Year', dataField: 'year', width: 150 },
                        { text: 'Population', dataField: 'population', width: 200 },
                        { text: 'Country', dataField: 'country' }
                    ]
                });
    
                setTimeout(function () {
                    $(gridSelector).jqxGrid('selectcell', 0, 'name');
                    $(gridSelector).jqxGrid('focus');
                }, 5);
            });
        })(jQuery);

    But it works well only in Internet Explorer. In Chrome the cell is selected, but grid has no focus and keyboard navigation does not work. What should I do to deal with this problem?

    Thanks

    jqxGrid('focus') does not work in Chrome #50082

    Peter Stoev
    Keymaster

    Hi alex_svs_fl,

    You do it incorrectly. ‘selectcell’ and ‘focus’ should be called within the Grid’s ready callback or within the Grid’s bindingcomplete event handler. Otherwise, you will try to focus element which is not created.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    jqxGrid('focus') does not work in Chrome #50116

    alex_svs_fl
    Participant

    Peter, thanks for answer. I have changed my code and placed the code $(gridSelector).jqxGrid(‘selectcell’, 0, ‘name’);
    $(gridSelector).jqxGrid(‘focus’); to ready() function in the grid initialization. But nothing has been changed, Chrome continues to work without focus on the required cell.

    jqxGrid('focus') does not work in Chrome #50118

    Peter Stoev
    Keymaster

    Hi alex_svs_fl,

    You are right. I am sorry for my previous response. It seems that I missed that. I will create a work item for the reported issue. The focus seems to be put only after you Click within the Grid, but the method does not work correctly in Chrome for some reason. We will do our best to fix that.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.