jQWidgets Forums

jQuery UI Widgets Forums Grid grid columntype is checkbox,not trigger cellbeginedit cellendedit event!

Tagged: 

This topic contains 3 replies, has 2 voices, and was last updated by  Yavor Dashev 4 years, 4 months ago.

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

  • toonice
    Participant

    Javascript/jQuery, jqxgrid columntype is checkbox,when ceckbox change value ,not trigger cellbeginedit,cellendedit,cellvaluechanged event!


    Yavor Dashev
    Participant

    Hi, toonice

    Would you like to share piece of your code in order to recreate the case you have encountered because I was unable to simulate the error you have mentioned.
    Also which version of the grid component do you use?

    Please, do not hesitate to contact us if you have any additional questions.

    Best regards,
    Yavor Dashev
    jQWidgets Team
    https://www.jqwidgets.com/


    toonice
    Participant

    version 11.0.1

    <body>
    <script>
    $(document).ready(function () {
    var editCellName = “”;
    var jqxGridsource =
    {
    type: “post”,
    datatype: “json”,
    contentType: “text/json”,
    datafields: [
    { name: ‘id’, type: ‘string’ }
    , { name: ‘f1’, type: ‘string’ }
    , { name: ‘f2’, type: ‘bool’ }

    ],
    url: ‘/EngineerManageQRCodeWCF/EngineerManageQRCodeWCF.svc/DisplayUser’,
    formatdata: function (data) {
    },
    beforeprocessing: function (data) {
    reuslt = JSON.parse(data.d);
    return reuslt;
    },
    addrow: function (rowid, rowdata, position, commit) {
    },
    updaterow: function (rowid, rowdata, commit) {

    //when ceckbox change value editCellName is null
    if (editCellName === “f2”) {
    updaterow();
    }
    }
    };
    var jqxgriddataAdapter = new $.jqx.dataAdapter(jqxGridsource);

    $(“#jqxGrid”).jqxGrid({
    //rowdetails: true,
    width: ‘100%’,
    height: ‘100%’,
    altrows: true,
    pageable: true,
    source: jqxgriddataAdapter,
    theme: JQWidgetsTheme,
    //localization:”zh-CN”,
    columnsresize: true,
    selectionmode: ‘multiplecellsadvanced’,
    pagesize: 30,
    autoloadstate: true
    pagesizeoptions: [30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90],
    pagerrenderer: pagerrenderer,
    virtualmode: true,
    showtoolbar: true,
    editable: true,
    enabletooltips: true,
    rowsheight: 86
    , rendergridrows: function (args) {
    return args.data;
    },
    columns: [

    {
    datafield: “id”, text: “id”, width: 250, editable: true, cellsalign: ‘left’, align: ‘center’
    },

    {
    datafield: “f1”, text: “username”, width: 250, editable: true, cellsalign: ‘left’, align: ‘center’
    }
    ,
    {
    datafield: “f2”, text: “test”, editable: true, width: 60, cellsalign: ‘center’, align: ‘center’, columntype: ‘checkbox’
    }
    ]

    });
    $(“#jqxGrid”).on(‘cellbeginedit’, function (event) {
    oldvalue = event.args.value;

    });

    $(“#jqxGrid”).on(‘cellendedit’, function (event) {
    editCellName = event.args.datafield;
    });
    });

    </script>
    <div id=”jqxGrid” style=”margin: 0;”>
    </div>
    </body>


    Yavor Dashev
    Participant

    Hi, toonice

    I was unable to recreate the problem with not triggering cellbeginedit,cellendedit,cellvaluechanged events with the code snippet you have shared in first post.
    However the problem in the code you shared is in the ‘updaterow’ function.When the EditCellName is ‘f2’ you call the ‘updaterow’ function again and this is the reason why the checkbox does not change its value. Instead in the ‘updaterow’ function should look like this:

    ` updaterow: function (rowid, rowdata, commit) {
    //when ceckbox change value editCellName is null
    if (editCellName === ‘f2’) {
    commit(true)
    }
    }`

    Please, do not hesitate to contact us if you have any additional questions.

    Best regards,
    Yavor Dashev
    jQWidgets Team
    https://www.jqwidgets.com/

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

You must be logged in to reply to this topic.