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

date_input_to_isoformat #97

Open
cnagytcorp opened this issue Dec 21, 2022 · 3 comments
Open

date_input_to_isoformat #97

cnagytcorp opened this issue Dec 21, 2022 · 3 comments

Comments

@cnagytcorp
Copy link

I can't get your example working, this function is part of what ? date_input_to_isoformat "Query.Deferred exception: date_input_to_isoformat is not defined ReferenceError: date_input_to_isoformat is not defined"
Removing it than the table works but obviously no longer able to filter by date_range.
Also how to make user__first_name and user__last_name in to 1 column ? If I just use user than cannot search user column "got error"
Had to split it to make it work.
{'name': 'First name', 'foreign_field': 'user__first_name', 'visible': True}, {'name': 'Last name', 'foreign_field': 'user__last_name', 'visible': True},
Documentation is extensive and looks great on first sight but for a beginner is difficult to understand what does what especially when english not the native language.
Sorry for commenting here as issue but havent found a forum where django-ajax-datatable being discussed in dept.
I'm greatly appreciate the work you put in to this, would like to learn more and make it usable in my project.

@cnagytcorp
Copy link
Author

cnagytcorp commented Dec 21, 2022

In time I have figured out that I need to add show_date_filter = True latest_by = 'created_at' to the main Class than I can use date range, also I have added date_input_to_isoformat to the extra data instead of extra_options. Still cant figure out how to use user as a column and be searchable. Any taught on that ?
Tried to add list as a value for foreign_field {'name': 'employee', 'foreign_field': ('user__first_name', 'user__last_name'), 'visible': True}, that just brake the whole thing and no longer works at all.

@morlandi
Copy link
Owner

morlandi commented Jan 2, 2023

Hello @cnagytcorp,
thank you for your interest in the project

To efficiently apply sorting and searching, i.e. delegating them to the database, each column of the javascript datatable must be associated with a specific column of the table in the database.

The criteria for formulating the search on the ORM side are automatically deduced from the context, while you would like to do a search on multiple columns.

I understand the need, and it seems interesting to me, but unfortunately it is not currently supported; it would be necessary to provide some mechanism for optionally replacing the criterion of the search on the column with an arbitrary expression.

Unfortunately I can't predict a short intervention in this sense, because I deal more with backend than with frontend, and for me this is a secondary project to which I can devote little time.

But I will keep the Issue open as a reminder, just in case.

@cnagytcorp
Copy link
Author

Thanks for the explanation, it's becoming my new favorite table rendering tool, realy like the compact layout and the customizability. Unfortunately being a novice in Python-Django it's a frustrating (sometimes fun) learning curve for me.
I do understand now why is this way, I don't think this is a bug, simply misunderstand it.
I do have a question though ( I know this isn't a support forum), how would I get another models related field in to the table..
#from user model
user_first_name, user_last_name,
#from schedule model where user is foreign_key to user_id
user_schedule

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

2 participants