Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

Global search error #135

Closed
idimkk opened this issue Jun 2, 2020 · 5 comments
Closed

Global search error #135

idimkk opened this issue Jun 2, 2020 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@idimkk
Copy link

idimkk commented Jun 2, 2020

Hi!
Thanks for fantastic library!

I have a strange error:
If I use ShowSearchBar="true" and Columns with Template this causes an error.

Sample

<Table TableItem="Object" Items="data" ShowSearchBar="true" TableClass="table" TableRowClass="@(x => x.GetRowClass())">
  <Column TableItem="Object" Title="Id" Field="@(x => x.ShortId)" Sortable="false" Filterable="true" />
    <Column TableItem="Object" Title="Request" Sortable="false" Filterable="false">
      <Template>
        <button @onclick="@(r => GetLog(@context))" class="btn btn-light">RQ</button>
      </Template>
    </Column>
</Table>

Next, we need to refresh the page, because it stops working.

Thank you!

@IvanJosipovic IvanJosipovic self-assigned this Jun 4, 2020
@IvanJosipovic IvanJosipovic added the bug Something isn't working label Jun 4, 2020
IvanJosipovic added a commit that referenced this issue Jun 4, 2020
Fix Bug #135
NuGet update
@IvanJosipovic
Copy link
Owner

Thank you for reporting this Bug, it has been fixed in 1.11.1

@idimkk
Copy link
Author

idimkk commented Jun 5, 2020

Hi @IvanJosipovic

Thanks for your update!
I updated nuget, but error still exists.

@IvanJosipovic
Copy link
Owner

Hi @idimkk, It's likely something more specific in your scenario.

Could you please look at 135.razor and update the repro scenario so that it fails?

Thank you

@IvanJosipovic IvanJosipovic reopened this Jun 5, 2020
@idimkk
Copy link
Author

idimkk commented Jun 6, 2020

Sorry, I recreate the file Razor and everything works well.
It's strange, but now it works fine.
Many thanks!

@idimkk idimkk closed this as completed Jun 6, 2020
@tkennedy13
Copy link

tkennedy13 commented Jun 24, 2020

I'm using version 1.11.1 and I get an error when I have a template column that uses shows a field from a related model. The error is System.NullReferenceException: 'Object reference not set to an instance of an object.'

Here is what the offending column look like:

<Column TableItem="Model" Title="Region" Field="@(x => x.Region.Name)" Sortable="true" Filterable="true" Width="5%">
	<Template>
		@(context.Region != null ? context.Region.Name : string.Empty)
	</Template>
</Column> 

Here is my entire table definition:

<Table TableItem="Model" Items="_churches" PageSize="50" ColumnReorder="true" ShowSearchBar="true" RowClickAction="RowClick" SelectionType="SelectionType.Single"
	   TableClass="table table-hover table-sm" TableHeadClass="thead-light">
	<Column TableItem="Model" Title="Name" Field="@(x => x.Name)" Sortable="true" Filterable="true" DefaultSortColumn="true" Width="10%" />
	<Column TableItem="Model" Title="Phone Number" Field="@(x => x.PhoneNumber)" Sortable="true" Filterable="false" Width="5%" />
	<Column TableItem="Model" Title="Email" Field="@(x => x.EmailAddress)" Sortable="true" Filterable="false" Width="10%">
		<Template>
			<a href="mailto:@context.EmailAddress">@context.EmailAddress</a>
		</Template>
	</Column> 
	<Column TableItem="Model" Title="Locality" Field="@(x => x.Locality)" Sortable="true" Filterable="true" Width="5%" />
   <Column TableItem="Model" Title="Region" Field="@(x => x.Region.Name)" Sortable="true" Filterable="true" Width="5%">
		<Template>
			@(context.Region != null ? context.Region.Name : string.Empty)
		</Template>
	</Column>                
	<LoadingDataTemplate>
		<div class="text-center">
			<p><em>Loading...</em></p>
		</div>
	</LoadingDataTemplate>
	<Pager ShowPageNumber="true" ShowTotalCount="true" />
</Table>

Everything works great if I comment out the "Region" column.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants