Open kartikeyas00 opened 3 years ago
Thanks for this, will take a look. Could you possibly revert all the linting diffs to make it easier to read please? Single quotes + 4 spaces indentation are the first differences I see
@Pegase745, I propose to run black formatter first (see #133), then rebase this PR on to get a proper diff.
@kartikeyas00 I don't fully understand what usecase this is solving. But then I haven't looked at this codebase in a while. If I recall correctly you can either use yadcf (or one of the other options) to
I can possibly come up with an example in the next couple of days. But yadcf_data
parameter will basically tell the server to either send or not send the options data from the server to client, in case when the client doesn't want it. Also it happens in the case of these three search options yadcf_select, yadcf_multiselect and yadcf_autocomplete
. I would suggest you to look at _set_yadcf_data
method in datatables.py module.
@tdamsma @Pegase745 Any update on this?
@tdamsma @Pegase745 Any update on this?
There are still a bunch of merge conflicts, making it really hard to see what the scope of the changes is. Can you resolve them and run black on your code to minimize the diff?
Regarding this issue, I have come up with a
_map_columns_with_params
private method in DataTables class in datatables.py module. This method compares columns data with the parameters data and map the correct column number to the columns data. As a lot of times in frontend columns are not in the correct order as they are in the backend. Also there are cases when extra dummy columns are added in the frontend and they disturb the sequencing, thus the results coming from the backend.I am also proposing a new
ColumnDT
params which isyadcf_data
Why?
When the search method is set as yadcf_select, yadcf_multiselect and yadcf_autocomplete then always yadcf data object is being returned from the backend even when someone doesn't want it as in some cases the data can be defined in the frontend and no data is required from the backend.
For example: If a column contains only yearly data, then one can easily define the options in the frontend for yadcf and backend doesn't have to look at all the records in that column and retrieve the unique records as the option. It can also save server processing.
This PR provides the
yadcf_data
params forColumnDT
class which can be set toFalse
when we don't want the yadcf_data. It would be default toTrue
Other improvements proposed
yadcf_multi_select
method in search_methods.py module have been improved to handlenull
from the JavaScript.In
DataTables
classadd_columns
method have been replaced withwith_entities
method in the query object asadd_columns
method was adding a column or columns on the top of the list of columns who already exists in the table or query butwith_entities
replaces the select list with the current entities which means it would only have the columns selected with thewith_entities
clause.