-
Notifications
You must be signed in to change notification settings - Fork 261
Parameters sample no REACT. #16
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
Parameters sample no REACT. #16
Conversation
84a9d9a to
a455a6d
Compare
Samples/Parameters/parameters.js
Outdated
|
|
||
| tableau.extensions.initializeAsync().then(function () { | ||
| tableau.extensions.dashboardContent.dashboard.getParametersAsync().then(function (parameters) { | ||
| parameters.forEach(processParameter); |
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.
Can you please add something to the HTML page if there are no parameters found? Something like "No parameters found. Add some parameters to this dashboard to see this work."
| # Project Frelard | ||
|
|
||
|  | ||
|  |
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.
this is good :)
Samples/Parameters/parameters.js
Outdated
| const table = $('#parameterTable'); | ||
| const tableBody = table.children('tbody'); | ||
|
|
||
| let onParameterChange = function (evt) { |
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.
are we standardizing in our samples on 'evt' for event? fine if so just want to make sure we're consistent.
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.
I wouldn't say it's something we necessarily need to standardize on. I've been using fooEvent , i.e. filterEvent. No preference though.
Samples/Parameters/parameters.js
Outdated
| const tableBody = table.children('tbody'); | ||
|
|
||
| let onParameterChange = function (evt) { | ||
| evt.getParameterAsync().then(function (param) { |
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.
need to handle the case where there are no parameters present
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.
Yeah this would go for all the samples. I can go through and update them all after we get the base stuff merged in if you'd prefer @RussTheAerialist. Like his sample my tables all are just empty when the object in question is missing.
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.
I'll add something simple.
| }; | ||
|
|
||
| let column = function (value) { | ||
| const row = $('<td>'); |
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.
confusing to call (a table 'cell') a row
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.
names are hard. It should be cell :)
Samples/Parameters/parameters.js
Outdated
| return row; | ||
| }; | ||
|
|
||
| let allowableValues = function (value) { |
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.
would be nice to have a comment for this function to explain what it's doing...e.g. 'this will format the text and show the allowed values that can be set for the given filter'
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.
Yeah I would second adding more comments in general, a lot of our developers aren't always javascript savvy so I've tried to go a bit heady on the comment side of things.
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.
Yup, I'll do a commenting pass this morning.
Samples/Parameters/parameters.js
Outdated
| }; | ||
|
|
||
| let processParameter = function (p) { | ||
| p.addEventListener('parameter-changed', onParameterChange); |
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.
I'd use the enum value here, tableau.TableauEventType.ParameterChanged
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.
Ah okay, I didn't know that existed. I was basing this off of the React sample and it used the string. I'll switch to the enum.
Samples/Parameters/parameters.js
Outdated
| @@ -1 +1,64 @@ | |||
| //TODO | |||
| $(document).ready(function () { | |||
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.
The convention Samm and I have been following has been to wrap the whole extension inside an anonymous function, leaving our function definitions outside of the document ready branch. I don't know enough about JavaScript to say which way is better but we should probably do to the same thing.
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.
Is there an example of what you mean here?
Samples/Parameters/parameters.js
Outdated
| const table = $('#parameterTable'); | ||
| const tableBody = table.children('tbody'); | ||
|
|
||
| let onParameterChange = function (evt) { |
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.
On a related note, we are using different function declaration styles. I would lean towards function foo () { }; syntax because I think it's more approachable to non-JS developers (which I'd bundle most Tableau developers into).
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.
Sure, I don't have a preference one way or the other for either of those two points.
Samples/Parameters/parameters.js
Outdated
| }; | ||
|
|
||
| let textColumn = function (value) { | ||
| const row = $('<td>'); |
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.
This is much cleaner syntax than I've been using, I was using the dom API not jquery, so I'll go through and update my samples.
Also if you have time pleas give mine a looksy because I'm sure there are plenty of places I can tidy up :)
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.
Will do!
|
This looks sharp thanks again for making. Just a few areas we should sync up on so that our sample code looks more uniform. |
* Added Settings Sample * added datasource sample * cleanup * moved from innerHTML to jquery.text() * added missing gitignore and removed nod_modules * Added semistandard linter * Fixed tslint errors for settings and datasources * added 0.6.1 with parameter id change * updating to use 0.6.1 * added filtering sample * Parameters sample no REACT. (#16) * removing old images and updating Flex * Fetching is complete * Fix style issues * parity with original demo, but uglier * Address code review feedback * moving to wrapping everything into an anonymous function * Initial tutorial (#17) * Initial checkin * Initial react checkin * Progressing along * Paste in old readme * React progress * Eventing * Complete functionality * Switch to modal * Add loading screens * readme updates * Part 0 with links * Part 1 readme * Fix links * More tutorials * Part 3 readme * Full res gif * Part 4 * Part 5 * Part 6 and a complete manfiest * Clean up initial readme * Better screenshot for part 3 * Completed screenshot * Delete unused test stuff * Cleanup * Add note about the react version * first round of feedback responses * Lint errors for tutorial * bug fixes
No description provided.