mcslayton

Forum Replies Created

Viewing 13 replies - 1 through 13 (of 13 total)
  • Author
    Replies
  • in reply to: Enter Key propagates out of jqGrid when pressed inline edit #124220
    mcslayton
    Participant

    Hi Tony,

    The problem has been fixed. Thank you very much for the quick response to resolving this issue.

    Regards,

    Marv

     

     

    mcslayton
    Participant

    Tony,

    The whole point of reporting this issue wasn’t that I could not find a fix, but that the behavior of jqGrid v5.0.0 changed from v4.8.2.

    If you return to thecybersafe.net you will see that I have two identical versions of this page — one referencing v5.0.0 and the other v4.8.2, with a button on each page to flip back and forth.

    The v5.0.0 page clicks the ‘Show Data’ button when you hit enter on the inline edit selected line after you change the description and the v4.8.2 does not.

    Applying the fix you mentioned could be a problem since I have hundreds of pages that may or may not have form submit requirements.

    Thanks,

    Marv

     

     

     

    mcslayton
    Participant

    Hi Tony,

    I agree that the page you gave me works okay — why yours works and mine does not I do not know. Here is a link to a totally standalone HTML file that on Windows 10, 8.1 and 7 — any browers — does not work for me.

    thecybersafe.net

    By the way, after you change the Region description press the Enter key. I get the JSON display of the data object — not the saving of the edited row.

     

    • This reply was modified 10 years, 8 months ago by mcslayton.
    mcslayton
    Participant

    <%@ Page Language=”C#” AutoEventWireup=”true” CodeFile=”InlineEditStandalone.aspx.cs” Inherits=”InlineEditStandalone” %>

    <!DOCTYPE html>

    <html xmlns=”http://www.w3.org/1999/xhtml”&gt;
    <head runat=”server”>
    <meta http-equiv=”X-UA-Compatible” content=”IE=edge,chrome=1″ />
    <title>jqGrid Inline Edit Test</title>
    <!– cupertino, redmond, hot-sneaks, start, ui-darkness, mint-choc, smoothness –>
    <link type=”text/css” rel=”stylesheet” href=”//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/hot-sneaks/jquery-ui.css” />
    <link type=”text/css” rel=”stylesheet” href=”jqGrid/ui.jqgrid.5.0.0.css” />
    <style type=”text/css”>
    body {
    font-family: Arial;
    }

    .ui-widget {
    font-size: 0.8em;
    }

    .ui-jqrid {
    font-family: 0.8em;
    }

    .ui-widget-overlay {
    opacity: 0.4 !important;
    background: inherit;
    background-color: #aaa;
    }
    </style>
    </head>
    <body>
    <form id=”form1″ runat=”server”>
    <asp:ScriptManager ID=”scriptManager” runat=”server” EnablePageMethods=”true” EnablePartialRendering=”false”>
    <Scripts>
    <asp:ScriptReference Path=”//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js” />
    <asp:ScriptReference Path=”//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js” />
    <asp:ScriptReference Path=”~/jqGrid/i18n/grid.locale-en.5.0.0.js” />
    <asp:ScriptReference Path=”~/jqGrid/jquery.jqGrid.5.0.0.min.js” />
    </Scripts>
    </asp:ScriptManager>

    <table id=”dgRegions”></table>
    <table id=”pgRegions”></table>

    <button id=”btnShowData” style=”display: none;”>Show Data</button>
    <script type=”text/javascript”>
    var data = {};
    var lastSel;

    function cancelEditing(myGrid) {
    if (lastSel != null) {
    $(myGrid).jqGrid(‘restoreRow’, lastSel);
    var lrid = $.jgrid.jqID(lastSel);
    $(“tr#” + lrid + ” div.ui-inline-edit, ” + “tr#” + lrid + ” div.ui-inline-del”).show();
    $(“tr#” + lrid + ” div.ui-inline-save, ” + “tr#” + lrid + ” div.ui-inline-cancel”).hide();
    }
    }

    function LoadGrid(data) {
    if ($(‘#dgRegions’)[0].grid) {
    $(‘#dgRegions’).jqGrid(‘GridUnload’);
    }
    var dgRegions = $(‘#dgRegions’).jqGrid({
    datatype: ‘local’,
    data: data.rows,
    cmTemplate: {
    searchoptions: { sopt: [‘bw’, ‘cn’, ‘nc’, ‘eq’, ‘ne’, ‘lt’, ‘le’, ‘gt’, ‘ge’, ‘bn’, ‘in’, ‘ni’, ‘ew’, ‘en’] }
    },
    colModel: [
    { name: ‘RegionID’, hidden: true, key: true },
    {
    label: ‘Region’, name: ‘RegionDescription’, index: ‘RegionDescription’, editable: true, editoptions: { size: 40, maxlength: 50 }, editrules: {
    custom: true,
    custom_func: function (value, label) {
    if (value.trim().length === 0)
    return [false, $.validator.format(‘{0}: Field is required’, label)];
    else if (value.substr(0, 1) === ‘ ‘)
    return [false, $.validator.format(‘{0}: Field cannot begin with space’, label)];
    else
    return [true, ”];
    }
    }
    },
    {
    label: ‘ ‘, formatter: ‘actions’, width: 60, fixed: true, search: false,
    formatoptions: {
    url: ‘clientArray’,
    keys: true,
    delbutton: false,
    onEdit: function (rowid) {
    if (lastSel != null && rowid !== lastSel) {
    cancelEditing($(this));
    }
    lastSel = rowid;
    },
    afterSave: function (rowid) {
    var row = $(this).getRowData(rowid);
    $.each(data.rows, function (i, drow) {
    if (drow.RegionID === row.RegionID) {
    drow.RegionDescription = row.RegionDescription;
    return false;
    }
    });
    }
    }
    }
    ],
    caption: ‘R e g i o n s’,
    pager: ‘#pgRegions’,
    sortname: ‘RegionDescription’,
    sortorder: ‘asc’,
    width: 500,
    height: ‘100%’,
    pginput: true,
    pgbuttons: true,
    rowNum: 15,
    rowList: [10, 15, 20, 25],
    viewrecords: true,
    shrinkToFit: true,
    onSelectRow: function (rowid) {
    if (lastSel != null && rowid !== lastSel) {
    cancelEditing(this);
    }
    lastSel = rowid;
    }
    });
    dgRegions
    .jqGrid(‘filterToolbar’, {
    searchOperators: true,
    stringResult: true
    })
    .jqGrid(‘navGrid’, ‘#pgRegions’, { search: false, refresh: false, edit: false },
    { width: 400 },
    { width: 400 },
    { width: 400 }
    );
    }

    $().ready(function () {
    /* jqGrid 5.0.0 introduced a change that propagated the Enter key up the DOM outside the grid — code below cancels this behavior */
    //$(document).on(‘keydown’, ‘.ui-jqgrid .editable’, function (e, ui) {
    // if (e.which === $.ui.keyCode.ENTER) {
    // e.preventDefault();
    // }
    //});

    $(‘#btnShowData’).button().click(function (e, ui) {
    alert(JSON.stringify(data));
    e.preventDefault();
    });

    data.rows = [
    { RegionID: 1, RegionDescription: ‘Eastern’ },
    { RegionID: 2, RegionDescription: ‘Northern’ },
    { RegionID: 3, RegionDescription: ‘Southern’ },
    { RegionID: 5, RegionDescription: ‘Testing’ },
    { RegionID: 4, RegionDescription: ‘Western’ }
    ];

    LoadGrid(data);
    $(‘#btnShowData’).show();
    });
    </script>
    </form>
    </body>
    </html>

    mcslayton
    Participant

    I had to add the class .editable to narrow down cancelling the Enter Key only when editing an inline jqGrid entry.

    [code]

    $(document).on(‘keydown’, ‘.ui-jqgrid .editable’, function (e, ui) {
    if (e.keyCode === 13) {
    e.preventDefault();
    }
    });

    [/code]

    in reply to: Missing jqGrid defaults in 4.8.0?? #123607
    mcslayton
    Participant

    Hi Tony,

    Unfortunately, the change you made didn’t fix the issue. I had already tried adding $.jgrid.defaults to the extend myself, but that didn’t work. My default overrides are ignored.

    Excellent product by the way. I am using it extensively, with many of its features and configurations. Awesome!

    Marv

     

     

    mcslayton
    Participant

    tony said:

    Hello,

    Many thanks. Just fixed the problem in GitHub.

    Please let me know if this fix works.

    Regards


    Hi Tony,

    The fix works great! Thanks.

    Regards, Marv

    mcslayton
    Participant

    tony said:

    Hello,

    In which brower is this. I can

    mcslayton
    Participant

    OlegK said:

    Hi Marv,

    I think it's the old problem described here and here. As the workaround you can include

    $('#tabGrid').triggerHandler('jqGridAfterGridComplete');
    after
    $('#tabGrid').jqGrid('setFrozenColumns');

    In my opinion the method setFrozenColumns should execute the event handler

    mcslayton
    Participant

    tony said:

    Hello,

    Many thanks. Fixed in GitHub

    Regards


    Hi Tony,

    Thanks for the quick fix. It does fix the sorting issues when frozen columns are used, BUT, the issue with the rows sliding under the frozen columns is still there.

    The test case is:

    mcslayton
    Participant

    OlegK said:

    Sorry, but how you imagine to find the reason with such “bug report”. Do you use local sorting or remote sorting (or use loadonce: true option)? Do you have problem with sorting in all columns of in some columns?

    If you can't analyse to problem yourself, where is the test case (so other people could analyse the problem)? One can confirm the bug and fix it only if one can reproduce the problem.


    Test Case: http://app.thecybersafe.net/jqGridTest.aspx

    Sorry, since the bugs are so obvious I thought it wouldn't need a test case. There are two issues:

    1) the frozen columns feature doesn't work until you page the grid OR select an entry from the rowList dropdown.

    2) clicking on the column headers for sorting does nothing. Icon remains the same and the rows do not re-sort.

    in reply to: using jqgrid formatter as utility function externally #99825
    mcslayton
    Participant

    Tony,

    Thank you that change worked great! I needed the unformat as well so I implemented them as shown below.

    Can the unformats be called from $.fn.fmatter somehow as well?

    Marv


    in reply to: using jqgrid formatter as utility function externally #99818
    mcslayton
    Participant

    Devised my own solution that allows for formatting integers, numbers and currency using jqGrid's localization configurations:

Viewing 13 replies - 1 through 13 (of 13 total)

Stay connected with us in your favorite flavor!