CSV Export - yet again

Bauer

Well-Known Member
I'm convinced I am jinxed and there really is a 'Phil's Law' - i.e if something can go wrong, it will.
This morning I went to respond to a notice in my email re a response from troester regarding a forum post I made late last night. It was good way to start my day because she gave me a pat on the back for my efforts... "Looks nice".

In that post I thanked Rob for fixing the issue where the list CSV params were not being set as the 'Front end option' defaults. That was the good news.:)

But I also detailed all the other issues I still found with the CSV Export popup after updating from github yesterday afternoon. I also promised to post my changes at Github (which I did right after I started the thread here in the Community forum). At github, I suggested that the powers-that-be should review that thread for details of the changes, and why they were made.

Well, I couldn't respond to troester - because the fabrikar server was down - and now that it's come back I see everything was lost. So there is nothing for Rob or Hugh to reference regarding my github changes.:( So here I go again.

Normally I compose my posts in a text editor then cut and paste - and I did that for that particular post also, but for some reason I just cut and pasted it without saving it to my pc. THAT is "Phil's Law".

Anyhow, I can't even remember exactly all I wrote, as it was quite detailed and took me all evening to compose - but I'll try an abbreviated version. And the good news is I still have the screen-snip attachments that I had included.

See the first image, which is what the popup looked like after the github update (csvpopupAsIs.PNG) - and note how the formatting is off.

Also the way the popup window is now - it is no longer movable or resizeable - and if I open the Chrome developer toolbar the toolbar overwrites the bottom half of the popup window - and I can't even see or click the submit (Export) button or even move the popup form. (Just wondered what was wrong with the old style used for the popup and why it needed to be changed.

The code I posted at github late last night produces the popup looking like the attached image (latestChangesCSVExport.PNG) - and will prevent what is happening in that first image from happening again - and fixes the issues that still exits with the submit button ('Export') and the Download button - so that when you click the Export button the form options and the Export button are immediately hidden - and when you click the download button it is immediately hidden (so you can't click it again). Rob told me he fixed that but the latest changes still allowed the download button to be clicked multiple times (as it still didn't hide the Download button until the popup lost focus). So you could still click it again - and when you do, instead of an error as used to occur (because the file had just been deleted), the downloaded file was instead downloaded again - but it is a blank CSV file (which IMO is worst, or more confusing to the end-user, than getting the error).

I give up trying to re-invent the wheel all at once. So am pushing for just one change at at time. Hopefully the code I posted last night will get pulled into the Fabrik core and stop me from having to repeatedly re-tweak that popup every time I update from github.

Today I just added and tested some code for specifying the desired popup width for the List CSV Export Front end options - and will try to pass that onto github too, once I get past this hurdle. I did that because the element labels can be quite long in some cases and would need to word-wrap in that form. I see no reason why the width of that popup should be hard-coded and limited when there is so much horizontal space available on the screen.
 

Attachments

  • csvpopupAsIs.PNG
    csvpopupAsIs.PNG
    97.1 KB · Views: 123
  • latestChangesCSVExport.PNG
    latestChangesCSVExport.PNG
    123.9 KB · Views: 116
  • latestExportComplete.PNG
    latestExportComplete.PNG
    54.5 KB · Views: 123
Last edited:
I'm looking at the windowing code atm. As you may have noticed, we've been making some fairly drastic changes to a lot of this stuff, and this is part of the settling in process. So I'll probably need to code up a 'fitToContent' function for the CSV window, to allow it to fit to content without being modal.

Rob is looking at that PR. I think the consensus is we don't particularly want to code any more styling into the JS, so we'd probably pull that out and look at doing it in CSS. But the other stuff is copacetic.

Oh, and honestly, I didn't crash and burn the server just to destroy your posts. :)

-- hugh
 
I'm looking at the windowing code atm. As you may have noticed, we've been making some fairly drastic changes to a lot of this stuff, and this is part of the settling in process. So I'll probably need to code up a 'fitToContent' function for the CSV window, to allow it to fit to content without being modal.

Rob is looking at that PR. I think the consensus is we don't particularly want to code any more styling into the JS, so we'd probably pull that out and look at doing it in CSS. But the other stuff is copacetic.

Oh, and honestly, I didn't crash and burn the server just to destroy your posts. :)

-- hugh
Well considering that the list.js file is over 1,700 lines - I wouldn't call my changes 'drastic'. And Rob made most of the actual code changes (in response to some of my requests).

The way the code was written in the original pull request that I made last week - each option had a div wrapper with a unique class name - and I used those class names in my css, just because class names are easier than using the :nth child() selector - especially if options get added, removed, or the order changes. So CSS was the way I always intended/assumed the styling to work anyhow.

But the weird thing about that popup was the H4 and H5 tags. The css shows margins at the top and bottom (per the prostar template.css) - but on the screen the top margin ran up into the previous DIV. I couldn't figure how to make it look right, short of wrapping those h4 and h5 tags in a div too - or just setting the margin to 0 and hard-coding the styling in the js like I did.

The other problem with that CSV export form is there's no easy way to add custom JS like there is for other fabrik forms, so there's not much I could do other than change the list.js code itself.

As for the popup width - in my code I added a parameter to the admin list.xml that takes the popup width returned from some admin-entered php code. (That way I could change the width depending on which menu was being used (and which elements were included in the list display). I've already got that working if you want to just use that instead of reinventing the wheel. Nothing really 'drastic' about it, IMO. It was just a matter of adding a few lines to the view.base.php file (where the 'opts' variables used by list.js are set) to get/add the 'popup_width' (value returned from that new param/php) - or default to 340px if empty.

This 1970 high school grad had to look up 'copacetic' - and I'm not big on conspiracy theories, so I never suspected you of anything.:D I only know that "Phil's Law" is real! I also know that, as my old T-shirt says, "Sh*t happens" - especially when it comes to things internet-related. (Though I do find it hard to believe that you don't do a nightly backup of the forums - at least some sort of incremental backup of new posts each day. You might want to look into that!)

We've had incredible weather here this week - feels more like the middle of June than the middle of March (broke an all-time record at 88 degrees (31c) Tuesday). So I've been outside most of the day working on some long-overdue projects, in case anyone wonders why I'm only around during my morning coffee and after dark (New York Time).
 
Last edited:
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top