jQWidgets Forums

jQuery UI Widgets Forums Grid celldoubleclick

This topic contains 1 reply, has 2 voices, and was last updated by  Nadezhda 10 years, 6 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • celldoubleclick #63647

    nrlgroup
    Participant

    Hi,

    Please look at below code.

    $(“#DivUmbExpenseDetails”).jqxGrid(
    {

    width: ‘80%’,
    height: 300,
    source: dataAdapter,
    theme: ‘ui-redmond’,
    pageable: true,
    editable: true,

    selectionmode: ‘multiplecellsadvanced’,

    columnsheight: 23,

    localization: getLocalization(),

    ready: function () {
    // called when the DataTable is loaded.

    },

    columns: [
    { text: ‘ExpenseId’, dataField: ‘ExpenseId’, width: ‘10%’ },
    { text: ‘LineNumber’, dataField: ‘LineNumber’, width: ‘10%’ },
    {
    text: ‘Analysis’, dataField: ‘AnalysisCode’, width: ‘30%’,
    columntype: ‘textbox’,
    createeditor: function (row, cellvalue, editor) {
    //createeditor: function (row, cellvalue, editor, celltext, cellwidth, cellheight) {
    editor.jqxInput({
    placeHolder: “Select Code”,
    height: 23,
    width: ‘100%’,
    theme: ‘ui-redmond’,
    //searchMode:’none’,
    source: function (query, response) {

    var dataAdapter = new $.jqx.dataAdapter
    (
    {
    datatype: “json”,

    url: $(“#UExpAnalysis”).attr(‘href’),
    data:
    {
    featureClass: “P”,
    style: “full”,
    maxRows: 15,
    //username: “jqwidgets”
    }
    },
    {
    autoBind: true,
    formatData: function (data) {
    //data.name_startsWith = query;
    return data;
    },

    loadComplete: function (data) {
    if (data.length > 0) {
    response($.map(data, function (item) {
    var labeltext = item.Code + ‘ – ‘ + item.Description;
    return {

    label: labeltext,
    value: item.Code
    }

    }));
    }
    }
    }
    );

    }
    });

    editor.on(‘select’, function (event) {
    if (event.args) {
    var item = event.args.item;
    editor.val(item.value);
    //alert();

    }

    });

    },
    getEditorValue: function (row, cellvalue, editor) {
    // return the editor’s value.

    return editor.val();
    }

    },

    { text: ‘Description’, dataField: ‘Description’, width: ‘36%’ },
    {
    text: ‘Gross Value’, dataField: ‘GrossValue’, cellsalign: ‘right’, width: ‘12%’, cellsformat: ‘c2’

    },
    {
    text: ‘VAT Code’, dataField: ‘VatCode’, width: ‘10%’
    },

    {
    text: ‘VAT Value’, dataField: ‘VatValue’, cellsalign: ‘right’, width: ‘12%’, cellsformat: ‘c2’, editable:false,

    cellsrenderer: function (index, datafield, value, defaultvalue, column, rowdata) {

    var vval;

    if (value==undefined | value==” | value == 0) {

    if (rowdata.GrossValue == undefined) { rowdata.GrossValue = 0; }
    if (rowdata.VatCode == undefined | rowdata.VatCode == null | rowdata.VatCode == ”) {
    vval = 0;

    }
    else {
    //alert(rowdata.GrossValue);
    var gval = rowdata.GrossValue;
    for (var i = 0; i < vats.length; i++) {
    var row = vats[i];
    if (row.VatCode == rowdata.VatCode) {
    activevatrate = row.VatRate;
    }

    }

    vval = gval / ((100 + activevatrate) / activevatrate);
    vval = vval.toFixed(2);
    //$(“#DivUmbExpenseDetails”).jqxGrid(‘endcelledit’, index, “VatValue”, false);

    }

    }
    else {

    vval = value;
    }

    //alert(vval);

    //var vval = calvatvalue;
    return “<div style=’margin: 4px;’ class=’jqx-right-align’>” + dataAdapter.formatNumber(vval, ‘c2’, { currencysymbol: “£”, currencysymbolposition: “before” }) + “</div>”;
    }

    }

    ]

    });

    $(‘#DivUmbExpenseDetails’).on(‘celldoubleclick’, function (event) {

    alert(‘dblclick’);
    $(‘#DivUmbExpenseDetails’).jqxGrid(‘setcolumnproperty’, ‘VatValue’, ‘editable’, true);

    });

    ‘celldoubleclick’ event never fires…

    Any possible reasons ???
    My selection is ‘multiplecellsadvanced’

    Thanks in advance,
    Srivalli.

    celldoubleclick #63697

    Nadezhda
    Participant

    Hello Srivalli,

    Here is an example with “celldoubleclick” event and “multiplecellsadvanced” selection mode which is working on our side: http://jsfiddle.net/4rqoumco/. I also notice that you are using JavaScript Bitwise Operators if (value==undefined | value=='' | value == 0). Are they Bitwise Operators or should be Logical Operators:
    if (value==undefined || value=='' || value == 0)?

    Best Regards,
    Nadezhda

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

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

You must be logged in to reply to this topic.