Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

render 'Contain' with null #58

Open
jevchan91 opened this issue Jun 11, 2018 · 4 comments
Open

render 'Contain' with null #58

jevchan91 opened this issue Jun 11, 2018 · 4 comments

Comments

@jevchan91
Copy link

below this is main query with null return, render with 'number' parameter without problem.
number":null,"user":{"username":"test"}

below this is contain query with null, since render parameter is 'user.username', so datatable cant get '.username' and popup an error.
number":null,"user":{"user":null}

any solutions? thanks

@ypnos-web
Copy link
Owner

I think the only solution to this problem is to use a custom render callback which can then ignore null objects.

@challgren
Copy link

I agree it has been a very annoying. But the only solution I know is to use a customer render.

@ypnos-web
Copy link
Owner

Right now we use $.fn.dataTable.render.text() as a default render callback as it sanitizes the content (like h() method).

I wonder if we should use a default render callback that also ignores NULL. So far I found it might be better to not silently fail by default. But I wonder if we should have a 'defaultRenderCallback' kind of config for the helper.

@challgren
Copy link

I honestly think just using a custom rendered is fine. Im my use cases mainly I'm generating a link to a belongsTo relationship anyways so during the link generation I'm checking for null.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants