Code Monkey home page Code Monkey logo

Comments (16)

thechriskent avatar thechriskent commented on September 20, 2024 2

I am unable to recreate this issue and am going to close it since it is not an issue with any of the samples in this repo. Please feel free to create a new issue on sp-dev-docs/issues if this continues to be a problem for you. Thanks!

from list-formatting.

Telephunky avatar Telephunky commented on September 20, 2024 1

This works:

{ "$schema": "http://columnformatting.sharepointpnp.com/columnFormattingSchema.json", "debugMode": true, "elmType": "div", "children": [ { "elmType": "a", "attributes": { "target": "_blank", "href": { "operator": "+", "operands": [ "https://tenant.sharepoint.com/sites/devsite/", "[$ID]" ] } }, "txtContent": "Some text" } ] }

from list-formatting.

PerIngeH avatar PerIngeH commented on September 20, 2024 1

I have the same issue.
I can insert [$Title] as a part of the url, but using [$ID] gives me: Failure: Cannot read property 'valueOf' of null.

from list-formatting.

thechriskent avatar thechriskent commented on September 20, 2024 1

There is no difference between applying column formatting via PowerShell, the format this column display panel (listview), field or site column editing screens, or through the API using something like the Column Formatter webpart.

More likely, there is something else wrong with the format. Could you post the whole format for us to have a look? Thanks!

from list-formatting.

hariberry avatar hariberry commented on September 20, 2024 1

I had the same issue and I could reproduce and fix it.

The Error "Cannot read property 'valueOf' of null." occurs if, the field "ID" is manually added to the Listview.

You can fix the error by removing the Field from the Listview and by inserting the following Code:

{ "$schema": "http://columnformatting.sharepointpnp.com/columnFormattingSchema.json", "elmType": "a", "txtContent": "[$ID]", "attributes": { "target": "_blank", "href": { "operator": "+", "operands": [ "http://finance.yahoo.com/quote/", "[$ID]" ] } } }

from list-formatting.

thechriskent avatar thechriskent commented on September 20, 2024

@samikroy I'm a little late to the game, but at least currently, I can use your JSON format without issue on a modern listview. Is this still a problem for you?

from list-formatting.

sympmarc avatar sympmarc commented on September 20, 2024

I just tried both examples above, adding the JSON to a Number field, which had nothing to do with the JSON. I'm also not displaying the ID column in the view. In both cases, the link was generated and worked.

@PerIngeH, it's possible you have some other issue in your JSON. Can you try the examples above?

from list-formatting.

MrTinNguyen avatar MrTinNguyen commented on September 20, 2024

Hi PerIngeH,
You can create another column with calculated value from ID (For instance : [$IDText] - calculated) and see the magic will be happened.
.

from list-formatting.

kyzo avatar kyzo commented on September 20, 2024

I have same problem. When use [$ID] it is empty or error Failure: Cannot read property 'valueOf' of null.
Do you have any idea?

from list-formatting.

PerIngeH avatar PerIngeH commented on September 20, 2024

I used PNP Powershell to set the JSON to the field, that works. Then I can use the Json as provided and create a link using the [$ID] as a parameter.
https://capacreative.co.uk/2018/02/11/using-pnp-powershell-to-apply-modern-column-formatting/

from list-formatting.

kyzo avatar kyzo commented on September 20, 2024

Hmm I am not site collection admin and we are prohibited to use powershell.

from list-formatting.

PerIngeH avatar PerIngeH commented on September 20, 2024

You can run powershell pnp towards a site, but reckon youd need to be at least site admin. But youll probably have to work out the legal stuff first.

from list-formatting.

kyzo avatar kyzo commented on September 20, 2024

What is the difference when applying it via PNP Poweeshel and via JSON directly ? I still do not get it.

from list-formatting.

kyzo avatar kyzo commented on September 20, 2024

I was using about 5 different JSON snippets and if [$ID] is present there is always error.

{
"$schema": "http://columnformatting.sharepointpnp.com/columnFormattingSchema.json",
"elmType": "a",
"txtContent": "[$ID]",
"attributes": {
"target": "_blank",
"href": {
"operator": "+",
"operands": [
"http://finance.yahoo.com/quote/",
"[$ID]"
]
}
}
}

from list-formatting.

Marker4 avatar Marker4 commented on September 20, 2024

I had the same issue so I used a Calculated Field and set the formula to "=ID". In the JSON formatting where I was referencing "[$ID]", I replaced it with "@currentField"

from list-formatting.

richapma avatar richapma commented on September 20, 2024

I don't know if this should be considered a bug... but I think the issue is that [$ID] exists when you put the formatting on a list but if you put it on a document library [$ID] does not work but then you could do your filter on field FileLeafRef instead using [$FileLeafRef] when building a URL potentially. The other work around being that you add the calculated field to the document library.

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.