jQWidgets Forums

jQuery UI Widgets Forums Grid row color by attribute

Tagged: ,

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 10 years, 4 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • row color by attribute #64100

    Hanno
    Participant

    Hello list,

    I try to change the color of a row in a grid by attribute.
    I have a grid with different attributes. I have also an attribute (number) called “status” with 0 or 1 inside.
    If the status is 0, then the row should have the color green. If the status is 1 the row should have the default color from the theme.

    But unfortunately I have no idea how to do this. Is it possible? Perhaps someone can help me with that?

    Greetings
    Hanno

    var source =
    {
    datatype: “json”,
    datafields: [
    { name: ‘status’, type: ‘number’ },
    { name: ‘id_akzession’, type: ‘number’ },
    { name: ‘datum_erfassung’, type: ‘date’ },
    { name: ‘name_akzession’, type: ‘string’ },
    { name: ‘bemerkung_akzession’, type: ‘string’ },

    ],
    id: ‘id_akzession’,
    url:’php_scripts/data_akzession.php’,
    root: ‘data’,
    updaterow: function (rowid, rowdata, commit) {
    commit(true);
    },
    };

    var dataAdapter = new $.jqx.dataAdapter(source);

    $(“#akzessionsliste”).jqxGrid(
    {
    theme: theme,
    width: ‘99%’,
    //height: ‘100%’,
    autoheight: true,
    source: dataAdapter,
    ready: function () {

    },
    sortable: true,
    selectionmode: ‘checkbox’,
    //autorowheight: true,
    pageable: true,
    pagesize: 15,
    pagesizeoptions: [‘5′,’10’,’15’,’20’,’30’,’50’,’100′],
    showfilterrow: true,
    filterable: true,
    columnsresize: true,
    columnsreorder: true,
    columns:[
    { text: ‘Status’, filtertype:’number’, datafield:’status’, width: 80 },
    { text: ‘ID Akz.’, filtertype:’number’, datafield:’id_akzession’, width: 80 },
    { text: ‘Bearbeitung’, filtertype:’date’, datafield:’datum_erfassung’, cellsformat: ‘dd/MM/yyyy’, width: 80 },
    { text: ‘Beschreibung Akzession’, datafield:’name_akzession’, width: 80 },
    { text: ‘Bemerkung Akzession’, datafield:’bemerkung_akzession’, width: 80 },

    ]
    });

    row color by attribute #64103

    Peter Stoev
    Keymaster

    Hi Hanno,

    For changing the row color or cell color, please take a look at: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/gridcellclass.htm?arctic

    Best Regards,
    Peter Stoev

    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.