jQWidgets Forums

jQuery UI Widgets Forums Grid Multiple checkbox in a cell is not happening

This topic contains 6 replies, has 2 voices, and was last updated by  Peter Stoev 12 years, 10 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • Hi,I am having a scenario where i need to put multiple checkboxes in a cell and if i will select one of them ,i need to track or delete that particular checkbox with data.But i cant able to do.
    I can put single checkbox but multiple checkbox inside a cell…….not possible.How can i do.
    Datas will be like (in grid cell)

    checkbox1: dvd rom
    checkbox2: cd rom
    checkbox2: cd writter
    checkbox4: dvd writter

    If i want to delete checkbox3,i will check it and delete it.

    I am giving two links where inside cell multiple datas are there but i need with checkbox.

    http://stackoverflow.com/questions/6573784/how-to-restrict-maximum-height-of-row-in-jqgrid
    http://stackoverflow.com/questions/8686616/how-can-i-get-jqgrid-frozen-columns-to-work-with-word-wrap-on

    How can i do.Please help.Thanks in advance.

    Is it possible to put listbox inside a cell ,so that i can select the data and delete???

    If any changes need to be done inside plugins.Please let me know.


    Peter Stoev
    Keymaster

    Hi RajaniKantaPanda,

    Unfortunately, jqxGrid does not support multiple checkboxes in a cell. I am afraid that I can’t offer you a solution. The posted links are about a widget which is not developed by us.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Is it possible to put listbox having multiple items instead of checkboxes????


    Peter Stoev
    Keymaster

    Hi RajaniKantaPanda,

    You can display a HTML Select element inside a cell via a custom cells rendering function.

    For example:

    var cellsrenderer = function (row, columnfield, value, defaulthtml, columnproperties) {
    return '<select><option>Value 1</option><option>Value 2</option><option>Value 3</option></select>';
    }
    var dataAdapter = new $.jqx.dataAdapter(source, {
    downloadComplete: function (data, status, xhr) { },
    loadComplete: function (data) { },
    loadError: function (xhr, status, error) { }
    });
    // initialize jqxGrid
    $("#jqxgrid").jqxGrid(
    {
    width: 670,
    source: dataAdapter,
    theme: theme,
    pageable: true,
    autoheight: true,
    sortable: true,
    altrows: true,
    enabletooltips: true,
    columns: [
    { text: 'Product Name', datafield: 'ProductName', width: 250 },
    { text: 'Quantity per Unit', datafield: 'QuantityPerUnit', width: 150 },
    { text: 'Unit Price', datafield: 'UnitPrice', cellsalign: 'right', cellsformat: 'c2', width: 70 },
    { text: 'Units In Stock', datafield: 'UnitsInStock', cellsalign: 'right', cellsrenderer: cellsrenderer, width: 100 },
    { text: 'Discontinued', columntype: 'checkbox', datafield: 'Discontinued', width: 100 },
    ]
    });
    });

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Hi Peter, In your example one dropdownlist we can put inside a cell .But i want to put multiple dropdown inside a cell because i want to track more than one values from a cell.

    I am trying to put multiple checkboxes inside a cell.Its happening beacause i am passing html tags from controller.But i can’t able to track the selected checkbox values.Can you please help.

    //Controller

    [HttpGet]
    public JsonResult GDPerhipheralsAdmin()
    {

    List list = new List() {
    new PerhipheralsAdminJqgrid() { Select=true,mcb=” Dvd Writter Dvd Rom CD Writter CD Rom “, PartNumber =”PO10000”, PartDescription = “PO10000Description”,ImagewatchDescription=”PO10000ImageDescription”,AvailbleInImagewatch =true},

    };

    return Json(list, JsonRequestBehavior.AllowGet);

    }

    //View

    $(“#jqxgrid”).jqxGrid(
    {
    width: 950,
    height: 30,
    editable: true,
    source: dataAdapter,
    theme: theme,
    selectionmode: ‘singlecell’,
    autoheight: true,
    selectionmode: ‘multiplerows’,
    columnsresize: true,
    background: ‘red’,
    color: ‘white’,
    //checkboxes: true,
    ready: function (row, e) {
    //debugger;
    rowcount = $(“#jqxgrid”).jqxGrid(‘getdatainformation’).rowscount;
    //var rows = $(“#jqxgrid”).jqxGrid(‘selectedrowindexes’);
    //var rowh = rows.length;
    for (var i = 0; i < rowcount; i++) {
    $('#jqxgrid').jqxGrid('setrowheight', i, 90);
    }

    },
    columns: [
    { text: 'Select All', editable: false, columntype: 'checkbox', width: 70 },
    { text: 'Available In ImageWatch', editable: true, dataField: 'mcb',
    initeditor: function (row, cellvalue, editor) {
    //return " Dvd Writter Dvd Rom CD Writter CD Rom”;
    },
    cellsrenderer: function (cellvalue, cell, rowid, iCol, cellcontent, e, row, columnfield, value, defaulthtml, columnproperties) {
    debugger;
    //I did in 3 ways to track the value but not happening????????
    var checkd = null; //$(rowid). //cellcontent.datafield.mcb
    if (iCol.Checkbox1.Checked == true) {
    checkd += Checkbox1.value + “,”;
    }
    else if (rowid .Checkbox2.Checked) {
    checkd += Checkbox2.value + “,”;
    }
    else if (Checkbox2.Checked) {
    checkd += Checkbox2.value;
    }

    return checkd;
    }, width: 200
    },
    { text: ‘Dell Part Number’, editable: false, columntype: ‘textbox’, dataField: ”, width: 100 },
    { text: ‘Agile Part Type’, editable: false, dataField: ‘AvailbleInImagewatch’, width: 100 },
    { text: ‘Software Type’, editable: false, dataField: ”, width: 120 },
    { text: ‘Agile Description’, editable: false, dataField: ”, width: 160 },
    { text: ‘Brand Name’, dataField: ”, width: 120 },
    { text: ‘Hidden Internal’, dataField: ”, width: 70 },
    { text: ‘Hidden External’, dataField: ”, width: 70 }

    ]
    });


    Peter Stoev
    Keymaster

    Hi RajaniKantaPanda,

    You can take a look at this post: http://www.jqwidgets.com/community/topic/clickable-object-in-grid-cell/. It shows how to bind to a clickable object (like button) in a grid cell. The same approach can be used for other standard HTML elements.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.