Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Peter Morris
    @mrpmorris
    I am being thick
    Oh, no I'm not :(
    It doesn't seem to be validating my object
    Peter Morris
    @mrpmorris
        <DataGrid Data=@ServiceTypes Sortable Striped Responsive Bordered Editable Hoverable
                 UseValidation ShowValidationsSummary=@false
                  ShowPager ShowValidationFeedback
                  TItem="ServiceTypeListItemModel"
                  EditMode=@DataGridEditMode.Inline
                  RowInserting=@CreateAsync>
            <ChildContent>
                <DataGridInlineEditButtons />
            </ChildContent>
            <DataGridColumns>
                <DataGridColumn Editable SortDirection=@SortDirection.Ascending Caption="Name" Field=@nameof(ServiceTypeListItemModel.Name)>
                    <EditTemplate>
                        <TextEdit Text=@((string)context.CellValue) TextChanged=@(x => context.CellValue = x)>
                            <Feedback><Blazorise.ValidationError /></Feedback>
                        </TextEdit>
                    </EditTemplate>
                </DataGridColumn>
            </DataGridColumns>
        </DataGrid>
    private List<ServiceTypeListItemModel> ServiceTypes = new();
    
    public class ServiceTypeListItemModel
    {
        public Guid Id { get; set; }
        [Required]
        [MinLength(2)]
        public string Name { get; set; } = "";
    }
    according to the website, this is correct isn't it?
    Mladen Macanović
    @stsrki
    I'm out. Will be back in the office soon
    Seems to me that you are missing validation handler or mode type
    Peter Morris
    @mrpmorris
    Where can I set the validation handler to data annotations?
    Mladen Macanović
    @stsrki
    @mrpmorris Ah, I know what is wrong. You're using EditTemplate which is bypassing internal validation
    You will need to make use of TextExpression on a TextEdit
    Also, wrap TextEdit with Validation component
    Peter Morris
    @mrpmorris
    Installing 1.1 now
    So how do I change my EditTemplate?
                    <EditTemplate>
                        <Validation>
                            <TextEdit Text=@((string)context.CellValue) TextChanged=@(x => context.CellValue = x)>
                                <Feedback><Blazorise.ValidationError /></Feedback>
                            </TextEdit>
                        </Validation>
                    </EditTemplate>
    Mladen Macanović
    @stsrki
    Well, it should be something like this
    <EditTemplate>
    <Validation>
        <TextEdit Text=@((string)context.CellValue) TextChanged=@(x => context.CellValue = x) TextExpression="@(()=>context.Item.FirstName)">
            <Feedback><Blazorise.ValidationError /></Feedback>
        </TextEdit>
    </Validation>
    </EditTemplate>
    But I see a problem
    TextExpression="@(()=>context.Item.FirstName)" will target the wrong model
    Internally we have a model that is used just for data-annotations
    but it is now accessible from outside
    your best option is to use <Validation Validator="ValidationRule.IsNotEmpty">
    Peter Morris
    @mrpmorris
    The validations are in the contracts, I don't want to repeat them
    So it can't be done?
    Mladen Macanović
    @stsrki
    No, unfortunately
    We will have to expose the DataGrid.ValidationItem and then it will be possible
    Peter Morris
    @mrpmorris
    Damn it
    Mladen Macanović
    @stsrki
    I will discuss with David to see if it's safe
    Peter Morris
    @mrpmorris
    :thumbsup:
    Mladen Macanović
    @stsrki
    @mrpmorris I had a conversation with David to see what we, might do and we could create a new API that would make DataGrid easier
    Peter Morris
    @mrpmorris
    Looks like a good idea. I need to demo this today though, so I'm downloading another lib
    Mladen Macanović
    @stsrki
    We're loosing you 😭
    Peter Morris
    @mrpmorris
    Less work for you :)
    Mladen Macanović
    @stsrki
    not so bad after all :D
    Peter Morris
    @mrpmorris
    :D
    AlbertoPa @AlbertoPa upgrades to 1.1
    Alberto Passalacqua
    @AlbertoPa
    all smooth, just had to rename MessageAlert :-)
    Mladen Macanović
    @stsrki
    Nice 😀
    Alberto Passalacqua
    @AlbertoPa
    :-)
    on the other hand STJ is still giving me headaches, but it wouldn't be STJ if it wasn't LOL
    Mladen Macanović
    @stsrki
    STJ??
    Stefan Ossendorf
    @stefan.ossendorf:matrix.org
    [m]
    System.Text.Json
    Alberto Passalacqua
    @AlbertoPa
    that :-)
    a solution in search of a problem, practically
    Mladen Macanović
    @stsrki
    ahhh
    well, the purpose of STJ is to give us problems 🤣
    Alberto Passalacqua
    @AlbertoPa
    yep, no idea how it made it into production code
    Stefan Ossendorf
    @stefan.ossendorf:matrix.org
    [m]
    It's fast and more efficient than NSJ!
    Alberto Passalacqua
    @AlbertoPa
    it's broken beyond acceptable IMHO (and one of the main reasons I avoided using asp.net core for our project)
    Alberto Passalacqua
    @AlbertoPa
    How do you enable the close button in an alert?
    It shows, but can't close (I enabled Dismisable too)
    Alberto Passalacqua
    @AlbertoPa
    hmm this seems a change/regression in 1.1... the close button on alerts works in 1.0.6 :-?