gridstack.js | Build interactive dashboards in minutes | Dashboard library
kandi X-RAY | gridstack.js Summary
kandi X-RAY | gridstack.js Summary
Mobile-friendly modern Typescript library for dashboard layout and creation. Making a drag-and-drop, multi-column responsive dashboard has never been easier. Has multiple bindings and works great with React, Vue, Angular, Knockout.js, Ember and others (see frameworks section). Inspired by no-longer maintained gridster, built with love. Check and these demos.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of gridstack.js
gridstack.js Key Features
gridstack.js Examples and Code Snippets
Community Discussions
Trending Discussions on gridstack.js
QUESTION
ANSWER
Answered 2020-Oct-06 at 19:14as mentioned in the 'bug' reported https://github.com/gridstack/gridstack.js/issues/1405, he's mixing old API call of $(".grid-stack")
which is jquery code based for v0.6 and older and the latest version 2.x which uses GridStack.init()
to init and return a grid pointer.
GridStack does not use jquery API since 1.x
QUESTION
For our openUI5 application I have developed two custom controls. One utilizing the gridstack.js library and another using the HighCharts library. The former has the latter as aggregation 'charts' (1...n). When I update the property in the model(deleting, adding a chart), the wrapper control re renders the charts (default behavior).
Is there a way to prevent re-rendering of the aggregation, because it causes both libraries to reload some stuff and this behavior we must avoid.
I thought about calling validate() on the charts aggregation as well as overwriting the setAggregation in the wrapper control.
Any help would be appreciated.
...ANSWER
Answered 2020-Aug-06 at 13:29The solution was to use sap.ui.core.HTML; This control was meant for this scenario, its property preferDOM does exactly that. So instead of rendering the HTML of the libraries im using, i set it as content of the sap.ui.core.HTML control.
QUESTION
Is there any option to use gridstack.js
with each grid-stack-item
height
based on inner content like image
.
In my scenario each images
having different height so it's not showing correctly on card.
It gives scrollbar inside grid-stack-item
to view image, that is wrong.
Any option or workaround or other JS plugin/library that will restrict fixed height based on any factor.
Current behavior
Expected behavior
Height will be 100%
based on width so image aspect ratio
preserves.
ANSWER
Answered 2018-Aug-27 at 11:46I managed to do by setting up cellHeight
: 10
then get image
in resizestop
event and update updateWidget
.
Below is sample code for that resizestop
event.
QUESTION
I am trying to create this behavior and not sure whether Gridstack supports it or not. I have 3 Gridstack grids: Grid1, Grid2, and Grid3. Grid1 is a standalone grid and Grid3 is nested inside Grid2. I need to be able to drag widgets from Grid1 both into Grid2 (outer grid) and into Grid3 (nested grid). Following samples I was able to drag widgets between 2 top level grids and create a nested grid, but not combining these 2 together. If this is supported - any pointers are appreciated.
NB: Expand the snippet to full screen
...ANSWER
Answered 2019-Apr-30 at 12:36This is code from an old drag/drop fiddle I composed (an age ago!), with areas that are both draggable and droppable. The items that can be pulled across to either of the droppable areas can be dragged again from one area to another and dragged up and down. While the items are not sized the same as are in your example, it goes to show that the same user experience can be achieved by using simply jquery/jquery-ui without sticking to gridstack. You may save yourself some laborious hours by working outside the grid! ;)
Hope this helps
QUESTION
I'm using Gridstack for draggable div's. How do I get the new value of data-gs-y (so to which y-axis the div was dropped). Actually I tried this:
...ANSWER
Answered 2019-Apr-04 at 04:44I think you can use "mutation observer" to listen changes to the attribute 'data-gs-y' on each div element. I wrote following code and verified on this demo http://gridstackjs.com/demo/knockout.html
QUESTION
Running into a problem with my attempt to build a gridstack dash
I get "Uncaught TypeError: Cannot read property 'addWidget' of undefined" when trying to load the page.. (the code is based on the basic gridstack serialized demo https://github.com/gridstack/gridstack.js/blob/develop/demo/serialization.html)
my changed script section is
...ANSWER
Answered 2019-Jan-22 at 03:01It seems like the context of this in the loadGrid
method may be incorrect, try changing it to this:
QUESTION
I am creating a empty grid with gridstack.js and them adding new elements thougth its API. The new items are visualized correctly. They and are re-sizable, but I can not drag them around the grid. I tried to use enable()
and also enableMove(true, true)
but it seem have no effect.
This example only contains one elements, but i pretend to add more when it works.
This is the page:
...ANSWER
Answered 2018-Nov-14 at 10:33The div pased to the addWidget
function should have this structure to work correctly:
QUESTION
I am creating example application with Ractive.js and gridstack.js, but can't figure out how to add gridstack as a decorator. I think this is the proper way to add jQuery elements to ractive.js, please advise if it's not.
After I created a decorator and assigned it to the Dashboard
component it actually doesn't work and events from gridstackDecorator
aren't cached in the Dashboard
component.
I created this Fiddle with the code that doesn't work and the source is below:
Ractive.js component tree will look like:
...ANSWER
Answered 2018-Oct-21 at 18:28You have to instruct Ractive about on which element(s) you want your decorator to be called on by adding "as-${decoratorName}" to the element, like, in your case
QUESTION
We are undergoing an project in Angular 5/6 where we get prebuilt HTML pages, that use jQuery, gridstack.js and CSS for UI, that we'll implement as components. Assuming it's not possible to rewrite all the jQuery and JS code in Angular, is there any way to run the jQuery code provided in the tag directly in Angular?
I have already tried importing jQuery as:
...ANSWER
Answered 2018-Jun-21 at 07:33It is possible and could be a good intermediate step on a migration path.
I am working on a project right now where we have a JQuery-based app. It has a lot of CSS and HTML code inside the JS code to handle state changes and change content and styling accordingly. It is relatively messy.
We took a number of steps of migrating to Angular, with the first being what you are describing. It definitely already helped gain an overview of the code base and structure the code in a much more maintainable way than it was before.
- I took the HTML and broke it down into Angular components. For this step, we just left the JQuery code in the main AppComponent TS file. You can simply use JQuery in Angular TS files with a
declare const $: any;
. - I broke down the the JQuery code and migrated everything that was template related (e.g. changing parts of the DOM tree based on events/state) into the Angular HTML files.
- I took the one large CSS file and moved the CSS rules to the individual components.
- I went through the entire remaining JQuery code and piece by piece migrated it to proper Angular code.
It proved to be a viable strategy. We were first considering re-writing the entire project, but like this we always had a running version, could continuously run UI tests against it and piece by piece migrate.
All of that is to say: I would not see a JQuery/Angular mix as a final solution, but it can be a good migration strategy.
QUESTION
I have a dashboard with some widgets grouped into tabs that the user can click through. The widgets have default starting positions including height and width, but if the user moves or resizes them (using gridstack.js
) I save the new widget data to local storage.
If the user clicks between tabs the new widget positions are maintained.
ProblemWhen the user refreshes the page, the default widget positions are loaded instead of the data in local storage. I tried to set the new positions using getWidgetData()
but no luck.
I have checked local storage for my grid-layout
data and the new positions are present.
Here is Codepen since I think SO requires allow-same-origin
, thus breaking the snippet.
ANSWER
Answered 2018-Jun-18 at 22:46You need to look into few things.
The default examples that are available are for a single instance whereas you have multiple.
You are saving and loading the gridstack
in one go which means you have no track of the element grid-stack-item
and also you have no track which point belongs to which instance the first tab or the second,
So even if you get it to work it will try to position all the 6 different widgets inside the very first tab rather than loading it in their respective tabs.
So you need to make changes to the following
$('.grid-stack').on('change', function (event, items) {
getWidgetData()
assign
id
orcustom-data-id
attribute in yougrid-stack-items
so that they have a unique identifierwrap the tabs inside a conatiner with id
tabs-cotnainer
.
on the event change for the gridstack you should create the json object consisting the points in the sections dedicated to the tabs it will store like below.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install gridstack.js
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page