Search code examples
jquerygridster

How can resize only few widgets in gridster


I need one widget- 'widgetId 0' to span upto 2 columns and other widget- 'widgetId 1' to span upto 4 columns on resize. below are my 2 widgets:

 var serialize = [
    {
        "widgetId": "0",
        "text": "Test Info",
        "description": "",
        "type": "info",
         "path":"test-info.png",
        "dataType": "TEST_INFO",
        "position": {

            "col": 1,
            "row": 1,
            "size_x": 1,
            "size_y": 2


        }
    },
    {
        "widgetId": "1",
        "title": "Test Details",
        "description": "",
        "type": "info",
        "path":"test-details.png",
        "dataType": "TEST_DETAILS",
        "position": {
            "col": 2,
            "row": 1,
            "size_x": 2,
            "size_y": 2
        }
    }]

How can I achieve this?

Is there any javascript function to resize a particular widget?

Thanks


Solution

  • to be able to choose wether a widget can be resizable or not, give a look at my answer to this post

    To achieve the "controlled" resizing you can tune the x_size, y_size, and the [max_x_size, max_y_size] parameters of the add_widget function! For example set x_size = max_x_size to prevent resizing on "x" axis", set max_x_size = x_size + "n", to have the widget resizable only up to n columns on x axis, and so on...