question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question: use different data model for grid

See original GitHub issue

I would like to use product information in my grid. Is it possible to use these array values? The row would be used for the y value and the column for the x value.

    var products = [
        {
            name: 'Integer posuere erat a ante venenatis dapibus posuere velit aliquet.',
            row: 1,
            column: 1,
            width: 1,
            height: 1
        },
        {
            name: 'Integer oudawdawhuadhouwhoudw ahdowhodaw hoadwou',
            row: 1,
            column: 2,
            width: 1,
            height: 1
        }
    ];

If I try to use it like this I get an error.

        <grid-item v-for="item in layout"
                   :x="item.row"
                   :y="item.column"
                   :w="item.width"
                   :h="item.height"
                   :i="item.name">
            {{item.i}}
        </grid-item>

This is the error: [Vue warn]: Error in nextTick: "Error: VueGridLayout: Layout[0].x must be a number!"

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
TomFranssencommented, Oct 11, 2017

It makes sense. I will try to implement something similar. Thanks for the explanation.

0reactions
anilkumar-boykacommented, Jul 9, 2021

Here is an example i was getting data from server like this layout = [{“name”:1,config : {“x”:0,“y”:0,“i”:2,“h”:3,“w”,3}}]

And in my grid layout i was mapping data in this way <grid-item v-for="(item, i) in layout" :key="i" :x="item.config.x" :y="item.config.y" :w="item.config.w" :h="item.config.h" :i="item.config.i" > {{item.config.i}} </grid-item>`

above code giving me this error - [Vue warn]: Error in nextTick: “Error: VueGridLayout: Layout[0].x must be a number!”

so i made my layout element like this var layout = [{"x":0,"y":0,"i":2,"h":3,"w",3}];

<grid-item v-for="(item, i) in layout"

    `:key="i"`
   
    :x="item.x"
    :y="item.y"
    :w="item.w"
    :h="item.h"
    :i="item.i"
  >

{{item.i}} </grid-item> `` here only one root/parent object is there it solved my problem

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Combine Separate Questions into a Grid in Q
Right-click and select Set Question. Give the new question a Name like “Brand Attitude” and set the Question Type to Pick Any –...
Read more >
Questions about Relationships, the Data Model, and Data ...
The data grid shows row data for each table's level of detail. In the Data pane, fields and calculated fields are automatically organized...
Read more >
How to model a "grid" in a database? - Stack Overflow
I need to build a component, so that a user can define how many columns and rows the answer for his/her question should...
Read more >
1: Viewing a grid in the Short Drinks sample
For more information, see Restoring the Short Drinks sample database. The Short Drinks survey contains several grid questions. A grid question can be ......
Read more >
How can I pass a view model with multiple models in ... - Telerik
I got multiple grids in one view, and each grid shows different infos depends on the model, I'll use a simple model as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found