jQuery UI Widgets Forums Grid on focus

This topic contains 5 replies, has 2 voices, and was last updated by  Dimitar 9 years, 4 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    on focus Posts
  • on focus #66258

    rahisarm
    Participant

    Hi team.
    on focus is not working.
    when i click on a textbox a grid is opening inside a jqxwindow.When i double click
    on the grid i want to set values to textbox and set focus to another texxtbox.Here
    everything works just fine.but the focusing not.
    I tried the jquery ,javascript focus methods.
    Below is my code

    $(‘#jqxNonPoolAccGrid’).on(‘rowdoubleclick’, function (event)
    {

    var rowindex1=event.args.rowindex;
    document.getElementById(“txtaccname”).value= $(‘#jqxNonPoolAccGrid’).jqxGrid(‘getcellvalue’, rowindex1, “description”);
    document.getElementById(“txtaccno”).value = $(“#jqxNonPoolAccGrid”).jqxGrid(‘getcellvalue’, rowindex1, “doc_no”);
    document.getElementById(“address”).value = $(“#jqxNonPoolAccGrid”).jqxGrid(‘getcellvalue’, rowindex1, “address”);
    document.getElementById(“tel1”).value = $(“#jqxNonPoolAccGrid”).jqxGrid(‘getcellvalue’, rowindex1, “com_mob”);
    document.getElementById(“tel2”).value = $(“#jqxNonPoolAccGrid”).jqxGrid(‘getcellvalue’, rowindex1, “per_mob”);
    $(‘#fleetno’).focus();
    $(‘#accountWindow’).jqxWindow(‘close’);

    });

    Thnks
    Best Regards
    Rahis

    on focus #66280

    Dimitar
    Participant

    Hello Rahis,

    Our suggestion is to try focusing the textbox on the jqxWindow close event, i.e.:

    $(‘#jqxNonPoolAccGrid’).on(‘rowdoubleclick’, function (event)
    {
    
    var rowindex1=event.args.rowindex;
    document.getElementById(“txtaccname”).value= $(‘#jqxNonPoolAccGrid’).jqxGrid(‘getcellvalue’, rowindex1, “description”);
    document.getElementById(“txtaccno”).value = $(“#jqxNonPoolAccGrid”).jqxGrid(‘getcellvalue’, rowindex1, “doc_no”);
    document.getElementById(“address”).value = $(“#jqxNonPoolAccGrid”).jqxGrid(‘getcellvalue’, rowindex1, “address”);
    document.getElementById(“tel1″).value = $(“#jqxNonPoolAccGrid”).jqxGrid(‘getcellvalue’, rowindex1, “com_mob”);
    document.getElementById(“tel2″).value = $(“#jqxNonPoolAccGrid”).jqxGrid(‘getcellvalue’, rowindex1, “per_mob”);
    $(‘#accountWindow’).jqxWindow(‘close’);
    
    });
    
    $('#accountWindow').on('close', function(event) {
        $('#fleetno').focus();
    });
    on focus #66295

    rahisarm
    Participant

    Hi Dimitar.
    I tried your suggestion.But bad luck..Unfortunately it doesnt work..
    I tried both jquery and pure js methods…
    With Regards
    Rahis

    on focus #66385

    Dimitar
    Participant

    Hi Rahis,

    Please share a JSFiddle example demonstrating your issue so that we may better understand why it occurs.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    on focus #66412

    rahisarm
    Participant

    Below is my code..
    <jsp:include page=”../../../../includes.jsp”></jsp:include>
    <script type=”text/javascript”>
    var datafleet= ‘<%=com.operations.saleofvehicle.vehiclestatuschange.ClsFleetStatusChangeDAO.fleetSearch(session) %>’;
    $(document).ready(function () {

    //var url=”demo.txt”;
    var num = 0;
    var source =
    {
    datatype: “json”,
    datafields: [
    {name : ‘fleet_no’ , type: ‘String’ },
    {name : ‘flname’, type: ‘String’ },

    ],
    localdata: datafleet,
    //url: url,
    pager: function (pagenum, pagesize, oldpagenum) {
    // callback called when a page or page size is changed.
    }
    };
    var dataAdapter = new $.jqx.dataAdapter(source,
    {
    loadError: function (xhr, status, error) {
    alert(error);
    }
    }
    );
    $(“#fleetSearch”).jqxGrid(
    {
    width: ‘100%’,
    height: 375,
    source: dataAdapter,
    columnsresize: true,
    //pageable: true,
    altRows: true,
    // editable: true,
    selectionmode: ‘singlerow’,
    //Add row method
    columns: [
    { text: ‘Fleet No’, datafield: ‘fleet_no’, width: ‘20%’ },

    { text: ‘Fleet Name’, datafield: ‘flname’, width: ‘80%’}

    ]
    });

    $(‘#fleetSearch’).on(‘rowdoubleclick’, function (event) {
    var row2=event.args.rowindex;
    var row5=document.getElementById(“disposalrow”).value;
    var fleetno=$(‘#fleetSearch’).jqxGrid(‘getcellvalue’, row2, “fleet_no”);
    var fleetname=$(‘#fleetSearch’).jqxGrid(‘getcellvalue’, row2, “flname”);
    $(“#disposalGrid”).jqxGrid(‘setcellvalue’, row5, “fleet_no”, fleetno);
    $(“#disposalGrid”).jqxGrid(‘setcellvalue’, row5, “flname”, fleetname);
    $(‘#fleetwindow’).jqxWindow(‘close’);
    });

    });
    </script>
    <div id=”fleetSearch”></div>

    ===========================================
    here im linking all the js libraries through the “includes” page..
    Below is my jqxwindow defining code..
    $(‘#fleetwindow’).jqxWindow({ width: ‘30%’, height: ‘58%’, maxHeight: ‘58%’ ,maxWidth: ‘50%’ , title: ‘Fleet Search’ ,position: { x: 250, y: 60 }, keyboardCloseKey: 27});
    $(‘#fleetwindow’).jqxWindow(‘close’);

    ==========================================
    Best Regards
    Thnks

    on focus #66467

    Dimitar
    Participant

    Hi Rahis,

    This code is not sufficient for us to determine the source of the issue. Please provide us with a complete example (preferably at JSFiddle) including the HTML of the textboxes in question. If you choose to post your code here, remember to format it by selecting it and clicking on the code button in the toolbar.

    Please also note that widgets in jqxWindow should be initialized in its initContent callback function (example).

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

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

You must be logged in to reply to this topic.