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
Add menu for joining columns #2110
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for working on this Mathieu! I look forward to more contributions from you in the future!
I've noted a few grammatical changes in the dialog that I think will help.
Thanks! I will submit a new version in a few days. |
I also tried to wrap the call with a setTimeout of 2 seconds, but has no effect... |
(By the way I also thought of a latter improvement : join ALL columns regardless to their name and number, with a forEach() loop!. This could improve reproducibilty. I think this is the same idea as #1724 ) |
@msaby maybe we should have an "all" functor. |
@ettorerizza gave this solution in a message to the support list :
|
main/webapp/modules/core/scripts/views/data-table/menu-edit-column.js
Outdated
Show resolved
Hide resolved
An other point : Should I use simply var variable instead of self.variable ? |
For local variables inside a function, I would use |
The removal seems to work with that recursive code. Is it ok for you ?
|
Nice! I think it could potentially be cleaner to remove them all in one operation (to get a more compact history), but it's not a hill I would die on! |
How would you remove them all in one operation @wetneb ? |
I'm trying to reuse code from column-reordering-dialog.js in order to remove all columns in one step. In the process I found something disturbing : In the function used for removing columns, I begin to retrieve all the colums of the project :
As this function is called in a callback in the "Refine.postCoreProcess("add-column"...)" or the "doTextTransform(column.name,...", I thought theProject.columnModel.columns will contain the column created by "Refine.postCoreProcess("add-column"...)". It seems it is not the case... I looked at project.js to understand. Refine.postProcess make this POST call :
So if I understand well the callback (onDone) is called after the POST request is made, but there is no assurance that the Java backend process is completely executed when the callback is called. Or maybe am I missing something? The console.log gives me all the columns in theProject.columnModel.columns after the creation of the "ddd" column, but this column is not listed |
@msaby I think for short-running operations (basically everything except reconciliation and fetching urls), the HTTP request completes after the operation is fully executed in the backend. But that does not necessarily mean that the browser has fetched the updates entirely! You might need to either trigger these updates manually, or use another function than |
I have digged in project.js.
So even if I wait 1 day, theProject will not update, but it does not mean the backend has not finished to process the request ;-) |
Here is a 3rd commit As suggested by @wetneb I now remove all columns in one operation. I also fixed an issue I found with backspace and quotes in column names and separator and replacement character, and added an option for interpreting \n and \t as newlines and tab (same logic as the replacement menu I wrote last year) Result: |
@msaby quick follow up on this: I have found myself using OR for a project and your Join operation was exactly what I needed, thanks a lot! It works great. |
This patch adds a new "Join columns" entry in "Edit column" menu.
The dialog box looks like that:
To test : create a project with at least 10 columns and different type of values (strings, blank strings, numbers, dates, booleans, null) and play with the options.
Ex:
Under the hood it is a wrapper around GREL "join()" function.
For the UI, I did not keep the "traditional" layout of OR made with tables (gave me headache). Instead I used divs and custom css.
For me everything looks ok EXCEPT for the "delete joined columns" option. It seems that this code is wrong. It raises error message in alert box (I put them in comments), as if the successive Refine.postCoreProcess were "treading on there toes". Could someone help please?