jQuery UI Widgets Forums Grid Change column color base on other column value

This topic contains 2 replies, has 2 voices, and was last updated by  Todor 4 years, 11 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author

  • AA5MC
    Participant

    Hello ,
    I have a json string that look like this( one record to keep it simple)

    [  
       {  
          "Id":103646,
          "Created":"2019-06-19T21:35:17.41",
          "Status":"File Sent To Flex",
          "Type":"PS",
          "JobName":"BA1782RJ",
          "JobNumber":"J0887597",
          "Qty":"QTY",
          "Seq":"SEQ",
          "FormId":"6230",
          "TotalPages":12,
          "FileSize":"1050790",
          "FileSizeVar":"1 MB",
          "OrginalFileName":"D:\\INBOUND\\Mainframe\\jqpld\\CTDPRINT.S0102876_96274-00083358.TXT",
          "NewFileName":"J0887597_BA1782RJ_SEQ_6230_QTY_01782-01066944-001-24-221R_D_FLEX_20190619_100000000000103646.PS",
          "Submitter":"P01782",
          "Site":"NA",
          "FileDate":"2019-06-19T09:35:13",
          "UniqueId":"100000000000103646",
          "RetentionPath":"\\\\server\\D$\\RETENTION\\MainFrameParser\\20190619\\jqpld",
          "LogFile":"\\\\server\\D$\\logs\\OmanMainFrameParser\\20190619\\CTDPRINT.S0102876_96274-0008335820190619093517.log",
          "Message":"Good",
          "Workflow":"GMC",
          "MPFWorkflow":"MAINFRAME",
          "ForeColor":"#000000",
          "BackColor":"#ADFF2F",
          "Modified":"2019-06-19T21:35:52.55",
          "GMCCount":1
       }
    ]

    I have a column called Status I want to set the background and foreground colors base on fields ForeColor and BackColor in my json string.

    best regards
    Mike


    AA5MC
    Participant

    if any was wondering on how to to this, its with the cellsrendererfunction :

    `{ text: “Status”, width: 50, datafield: “Status”, cellsalign: ‘center’, align: ‘center’, filtertype: ‘checkedlist’,
    cellsrenderer: function (row, column, value, defaultHtml, columnSettings, record) {
    var forecolor = record.ForeColor;
    var backcolor = record.BackColor;
    var element = $(defaultHtml);
    element.css({ ‘background-color’: backcolor });
    element.css({ ‘color’: forecolor });
    return element[0].outerHTML;
    return defaultHtml
    }},
    `
    best regards
    Mike


    Todor
    Participant

    Hello Mike,

    Thanks for sharing the solution with the community!

    Best Regards,
    Todor

    jQWidgets Team
    https://www.jqwidgets.com

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

You must be logged in to reply to this topic.