Jump to content

Wikipedia:Reference desk/Archives/Computing/2019 August 12

From Wikipedia, the free encyclopedia
Computing desk
< August 11 << Jul | August | Sep >> August 13 >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


August 12

[edit]

Excel queries and pivot tables

[edit]

I frequently write queries to our database by way of the MS query function in Excel. When I've done my thing and am ready to bring the data back, I'm given three main options: to dump the result into a table, into a PivotTable, or into a PivotChart. I usually use one of the first two, depending on what I want to do next. At the bottom of the dialog box is the option to import the data into the Data Model version of a pivot table, but it's greyed out, which is the problem. Searching online finds people with a similar situation, but they are in relation to creating a Pivot Table from an existing table, while I am coming at the problem from a different source. Any thoughts as to why the option is greyed out for me and how I can get around this? Perhaps alternatively, is there any way to convert a "normal" pivot table into a Data Model one after said PT is in existence? Searching online finds this unanswered question on Mr Excel from two years ago. Matt Deres (talk) 15:23, 12 August 2019 (UTC)[reply]

jQuery interpreting widths wrongly

[edit]

I've encountered a strange problem at work. The code uses jQuery to interpret the widths of elements and set child elements styles accordingly.

The problem is, jQuery interprets the widths wrongly. No matter what the actual widths are, the jQuery function width() always returns 100. This happens even if I only call the function from within $(document).ready() and $(window).load().

What is strange here is that the jQuery code works perfectly OK for elements written directly on the page. But it fails on elements that are only rendered via an @await Component.InvokeAsync() call, even though the actual jQuery code is still within $(document).ready() and $(window).load().

Why is this happening? Could it be because the jQuery code is executed before @await Component.InvokeAsync()? JIP | Talk 23:10, 12 August 2019 (UTC)[reply]

One thought is that it's returning the allocated length rather than the actual length. I have no idea why, however. SinisterLefty (talk) 02:49, 13 August 2019 (UTC)[reply]
It's hard to diagnose this without seeing it in action: can you make a small example that shows the behaviour and put it on CodePen or JSFiddle? AndrewWTaylor (talk) 06:26, 13 August 2019 (UTC)[reply]
I found out what was causing this. The elements that jQuery was failing at were inside a <div> that had a CSS class causing an animation lasting 0.15 seconds. That was apparently enough time for $(document).ready() and $(window).load() to fire before the elements had been fully rendered, causing jQuery to fail to find their exact widths. When I took the CSS class away the code started working. JIP | Talk 14:57, 13 August 2019 (UTC)[reply]
Glad you found it. SinisterLefty (talk) 15:23, 13 August 2019 (UTC)[reply]
Resolved

SinisterLefty (talk) 15:23, 13 August 2019 (UTC)[reply]