jQWidgets Forums

jQuery UI Widgets Forums Grid Grid with checkboxes

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

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Grid with checkboxes #17366

    dpdragnev
    Member

    Hi,

    I am experiencing a very strange problem. I have a grid that displays 2 columns: Name (string), Active (bool). I have set the Active column to display as checkbox. So far so good. The grid has several records and there is a vertical scroll bar to show the records that are not visible.

    The problem I noticed is that if the user checks a checkbox (for example on row index 2, 3rd from the top) and then scrolls down as soon as row 2 gets to be the first visible row, the next row’s checkbox gets checked as well. Almost as if the grid maintains the checked row based on the visible row index not the actual row index.

    If the user scrolls back up, checked checkboxes go back to unchecked state until the grid is at the top. At this moment rows with index 0, 1, and 2 are checked.

    This is an MVC application. I am getting the data from the controller in a json format. Here is my initialization code:

    var sourceRoles =
    {
    datatype: ‘json’,
    datafields:
    [
    { name: ‘RoleId’ },
    { name: ‘RoleName’ },
    { name: ‘Active’ }
    ],
    id: ‘RoleId’,
    url: ‘/Admin/GetRolesModelJson’
    }
    var dataAdapterRoles = new $.jqx.dataAdapter(sourceRoles);

    $(“#grdRoles”).jqxGrid(
    {
    width: 310,
    height: 200,
    source: dataAdapterRoles,
    theme: theme,
    editable: true,
    columns: [
    { text: ‘Role’, datafield: ‘RoleName’, editable: false },
    { text: ‘Active’, datafield: ‘Active’, columntype: ‘checkbox’, width: 80 }
    ],
    id: ‘RoleId’
    });

    Thank you.

    Daniel

    Grid with checkboxes #17387

    Peter Stoev
    Keymaster

    Hi dpdragnev,

    Please, set the “type” when you initialize the datafields array. You should set the “type” of each datafield to “string”, “number”, “date” or “bool”.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Grid with checkboxes #17486

    dpdragnev
    Member

    Hi Peter,

    Thank you for you response. I tried that and it did not work. I am still getting the same result. I tried it in different browsers but that did not make any difference.

    Do you have any other ideas on how to resolve this?

    Thanks.

    Grid with checkboxes #17489

    Peter Stoev
    Keymaster

    Hi dpdragnev,

    i.e you did that:

    datafields:
    [
    { name: 'RoleId' },
    { name: 'RoleName' },
    { name: 'Active', type: 'bool' }
    ],

    If the above does not work and your column is boolean, then send us a sample to support@jqwidgets.com and also make sure that you use jQWidgets 2.7 along with jQuery 1.7+ version.

    Best Regards,
    Peter SToev

    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.