Datagrid inline add not working when datasource is empty

Hi,

I really like the "Datagrid inline" page type. However, if the datasource contains no data then clicking on the ADD button has no effect - and no error. When I added data directly in the DB then it works. The result is the same if I use a filter on the datasource (page load event or on the grid directly); if there is no data in the filtered datasource, then button has no effect.

Table is pretty straight forward, (Id, Name) and page is automaticaslly generated on a brand new application, using latest build.

Thanks for your guidance.

Thanks! It will be fixed in the next update.

Good day. Is it fixed? Because It doesn't work now too... I have empty data grid with Add button, but when I click no effect. But when I debug component source code - it has new rows in object, but not in data grid...

Good morning,
same problem here: any news?

Thanks

@enchev any news about this bug?
Thank you very much


It doesn't work in my case: I load data from an api in the LoadData event (empty result list when there are no records) and I add the new firs row in the InsertRow as in the example but nothing happens.

<RadzenDataGrid @ref="_dataGrid1" AllowMultiColumnSorting="true" AllowFiltering="true" AllowPaging="true" AllowSorting="true" AllowColumnResize="true"
                FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive" FilterMode="FilterMode.Simple"
                PageSize="@_pageSize" Data="@_jobs" LoadData="@LoadData" TItem="JobDTO"
                IsLoading="@_isLoading"
                Count="@_count">

private async Task LoadData(LoadDataArgs args)
        {
            _isLoading = true;

            var filters = Builder.BuildSearchCriteria(args);
            var orderCriteria = Builder.BuildOrderCriteria(args);

            try
            {
                    _jobs = await CustomerHttpService.FindJobsAsync(filters, orderCriteria);
_pageSize = 50;
_count=_jobs.Count;
            }
            catch (Exception e)
            {
                Error.ProcessError(e);
            }

            _isLoading = false;
        }

        private async Task InsertRow()
        {
            var empty = new JobDTO
            {
                Customer = (EntityBaseDTO)(_jobs.FirstOrDefault()?.Customer ?? await CustomerHttpService.GetCustomersAsync(CustomerId))
            };
                await _dataGrid1.InsertRow(empty);
        }

@enchev please, could you provide me a working example with LoadData event?
Thanks

Hey @davide.n ,

Are you looking for dedicated support? You can check our forum FAQ for reference. Try also searching the forum before posting questions:

Thanks for the suggestion: finally I fixed the problem in this way:

        private async Task InsertRow()
        {
            var empty = new JobDTO();
            if (_jobs.Count == 0)
            {
                _jobs.Add(empty);
                _count++;
                await _dataGrid1.EditRow(empty);
            }
            else
                await _dataGrid1.InsertRow(empty);
        }

 private void CancelEdit(JobDTO job)
        {
            _dataGrid1.CancelEditRow(job);

            if(job.Id == null)
            {
                _jobs.RemoveAll(r => r.Id == null);
                _count--;
            }
        }