jQuery UI Widgets Forums Grid checkbox column in jqxgrid

This topic contains 3 replies, has 2 voices, and was last updated by  Dimitar 11 years, 8 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • checkbox column in jqxgrid #10196

    Nick
    Member

    Hi,

    I am using the jqwidgets 2.5 version and i have a issue with a checkbox column in jqxgrid on how to make this columns by default the checked property as false.

    Please find the code for the jqxgrid and the checkbox column.

    $(“#jqxObjGrid”).jqxGrid(
    {
    width: 350,
    editable: true,
    source: attrsDataAdapter,
    columnsresize: true,
    theme: theme,
    columns: [
    { text: ‘Comp Name’, dataField: ‘CompName’, columntype: ‘textbox’, width: 160, editable: false},
    { text: ‘Comp Region’, dataField: ‘Comp Region’, columntype: ‘textbox’, width: 100 , editable: true},
    { text: ‘Alloted’, dataField: ‘isAlloted’, columntype: ‘checkbox’, width: 100, editable: true, resizable: false},
    ],
    });

    Regards
    Nick

    checkbox column in jqxgrid #10197

    Dimitar
    Participant

    Hello Nick,

    The values of a column depend on your data source (in your case, the ‘isAlloted’ dataField). If all its values are false, the whole column will be unchecked. Your datafield should also have its type property set to ‘bool’ for the checkbox column to work properly.

    Best Regards,
    Dimitar

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

    checkbox column in jqxgrid #10205

    Nick
    Member

    Hi Dimitar,

    I have tried the option suggested by you , but i still see the column having the check boxes as checked.

    Though the first column with data field ‘CompName’ in my case is got from the datasource which is an array of values , but the next 2 columns are common for each row in the grid , one a text box and the other a checkbox as the code below.

    var attrList = new Array();

    // data is var holding the row details for first column
    if(data != null){
    for (var i = 0; i < data.length; i++) {
    var row = {};
    row["CompName"] = data[i];
    attrList[i] = row;
    }
    }

    var attrsSource =
    {
    datatype: "array",
    localdata: attrList
    };

    var attrsDataAdapter = new $.jqx.dataAdapter(attrsSource);

    $(“#jqxObjGrid”).jqxGrid(
    {
    width: 350,
    editable: true,
    source: attrsDataAdapter,
    columnsresize: true,
    theme: theme,
    columns: [
    { text: 'Comp Name', dataField: 'CompName', columntype: 'textbox', width: 160, editable: false},
    { text: 'Comp Region', dataField: 'Comp Region', columntype: 'textbox', width: 100 , editable: true},
    { text: 'Alloted', dataField: 'isAlloted', columntype: 'checkbox', width: 100, editable: true, resizable: false, type: ‘bool’},
    ],
    });

    As i see checkbox design with the newer version is a small box within it a black filled in square box for the first time, i guess that’s how it is designed with newer version but as i uncheck its blank and if i check it back again its a ‘tick’ mark that appears rather the filled-in square box.

    Please help me with the issue to have the checkbox not checked by default.

    Regards
    Nick

    checkbox column in jqxgrid #10206

    Dimitar
    Participant

    Hi Nick,

    The type property should be set in the datafields section of your source (absent in your case). To learn more about jqxGrid data sources, please check out the guide in the widget’s documentation Grid Data Sources.

    Best Regards,
    Dimitar

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

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

You must be logged in to reply to this topic.