Code Monkey home page Code Monkey logo

Comments (4)

PopWarner avatar PopWarner commented on June 20, 2024

Hi @AHJackson87, happy to help. :) One quick question...are you applying this to a "DueDate" field, which is an actual date field? If so, I noticed you are doing a comparison for your '@currentField', which would be a date, to a number, not a date.

If my assumption is right, that your looking to apply this to an actual date field, would this definition work for you? :)

{
    "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
    "debugMode": true,
    "elmType": "div",
    "txtContent": "@currentField",
    "attributes": {
        "class": "=if(@currentField <= @now, 'sp-field-severity--warning', '')",
        "iconName": "=if(@currentField <= @now, 'error', '')"
    }
}

This puts the icon before the date, you might want it after the date based on your post. Let me know if that's the case and I can try to create one for you that does that. :)

from list-formatting.

AHJackson87 avatar AHJackson87 commented on June 20, 2024

Thanks,
Yes you are correct the due date field is a date filed.

Have tried the the code you suggested to with no luck.

Is it possible to highlight the whole row rather than just adding an icon in that column?

from list-formatting.

PopWarner avatar PopWarner commented on June 20, 2024

Thanks for the quick reply @AHJackson87.. :)

When you say no luck, is it the color formatting or the icon not working? Or possibly nothing appears to have changed.

To help ensure we are using it the same way, here is how I see it in my list:
image

This is being used as a column formatting definition in the "DueDate" column. Were you applying it the same way? :)

To help answer your second question, you can apply a color to the row, but that is applied using the View Formatting strategy. There is a great demo of that available here:
https://github.com/SharePoint/sp-dev-list-formatting/tree/master/view-samples/text-conditional-format

from list-formatting.

thechriskent avatar thechriskent commented on June 20, 2024

Closing due to lack of activity. Feel free to reopen as needed, thanks!

from list-formatting.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.