Skip to content

addWidget(el, options) with object param#1038

Merged
radiolips merged 1 commit into
gridstack:developfrom
adumesny:develop
Nov 13, 2019
Merged

addWidget(el, options) with object param#1038
radiolips merged 1 commit into
gridstack:developfrom
adumesny:develop

Conversation

@adumesny

@adumesny adumesny commented Nov 13, 2019

Copy link
Copy Markdown
Member

Description

fix for #907

  • new addWidget(el, options) to pass object so you don't have to spell 10 params
  • updated TS file, test case, some samples
  • also renamed IGridstackOptions to GridstackOptions (angular/TS style guide avoid cap I for interfaces, the others were correct already).

Checklist

  • Created tests which fail without the change (if possible)
  • All tests passing (yarn test)
  • Extended the README / documentation, if necessary

* new addWidget(el, options) to pass object so you don't have to spell 10 params
* updated TS file, test case, some samples
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.1%) to 65.711% when pulling 52dfb46 on adumesny:develop into 0fc9b72 on gridstack:develop.

@radiolips radiolips merged commit a902f3c into gridstack:develop Nov 13, 2019
Comment thread src/gridstack.js
GridStack.prototype.addWidget = function(el, x, y, width, height, autoPosition, minWidth, maxWidth, minHeight, maxHeight, id) {

// instead of passing all the params, the user might pass an object with all fields instead, if so extract them and call us back
if (typeof x === 'object') {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will fail if we pass null as a value of x, as typeof null === 'object' returns true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants