Is it possible to set a read-only Name property for a collection?
I have a bunch of read-only collections, but when I use the SetNameProperty() to configure the Name column for the list view the Name is editable on the editor view (header). The changes can't be saved because I've disabled Create/Delete/Update for these collections. But editors still get an 'unsaved changes' warning when the accidentally change the Name value.
As a workaround I've removed the SetNameProperty() method and used the SetNameFormat() method instead, but the downside of using this method is that the list view can no longer be sorted by Name.
Is there a way to use SetNameProperty() but have the Name field read-only or disabled on the editor view?
When sorting on the Name column the orderBy parameter is null in GetPagedImpl() when only using the SetNameFormat() method to configure the Name property for the collection. Since I'm using a custom KonstruktRepository for my collections I was able to fix the issue by setting the orderBy to a specific property when it's null.
Yea, I'd say the best way to do this is to use SetNameFormat() like you are doing, however I've just run a test locally and when using SetNameFormat I am still able to sort on the name field in the list view 🤷♂️
Then it's probably due to my custom KonstruktRepository implementation. Like I said, I was able to fix it by setting the orderBy to a specific property when it's null:
In the OOTB implementation, is the orderBy parameter not null when sorting on the Name column with only SetNameFormat() being used and SetNameProperty() is left out completely?
Ahh, maybe it works for me because the field I'm falling back to is still called Name but it looks like you want InvoiceNumber, so if you had a Name property it would probably work.
Yeah, I just came to the same conclusion. I added a Name field to the custom collection class and used that for the SetNameFormat(), and now sorting works.
Is it possible to set a read-only Name property for a collection?
I have a bunch of read-only collections, but when I use the
SetNameProperty()
to configure the Name column for the list view the Name is editable on the editor view (header). The changes can't be saved because I've disabled Create/Delete/Update for these collections. But editors still get an 'unsaved changes' warning when the accidentally change the Name value.As a workaround I've removed the
SetNameProperty()
method and used theSetNameFormat()
method instead, but the downside of using this method is that the list view can no longer be sorted by Name.Is there a way to use
SetNameProperty()
but have the Name field read-only or disabled on the editor view?When sorting on the Name column the
orderBy
parameter is null inGetPagedImpl()
when only using theSetNameFormat()
method to configure the Name property for the collection. Since I'm using a customKonstruktRepository
for my collections I was able to fix the issue by setting theorderBy
to a specific property when it's null.Hey Arjan,
Yea, I'd say the best way to do this is to use
SetNameFormat()
like you are doing, however I've just run a test locally and when usingSetNameFormat
I am still able to sort on the name field in the list view 🤷♂️Then it's probably due to my custom
KonstruktRepository
implementation. Like I said, I was able to fix it by setting theorderBy
to a specific property when it's null:In the OOTB implementation, is the
orderBy
parameter not null when sorting on the Name column with onlySetNameFormat()
being used andSetNameProperty()
is left out completely?Seems to be populated for me 🤷♂️
Ahh, maybe it works for me because the field I'm falling back to is still called
Name
but it looks like you wantInvoiceNumber
, so if you had aName
property it would probably work.Yeah, I just came to the same conclusion. I added a Name field to the custom collection class and used that for the SetNameFormat(), and now sorting works.
is working on a reply...