1

I have a calendar grid and I want to colspan based on startcolumn + duration. How can I pass the variable col to the result of getItemMetadata?

I am using this example: http://mleibman.github.com/SlickGrid/examples/example-colspan.html

This works

dataView.getItemMetadata = function (row) {
  var col = 3;
  return {
    "columns": {
       3 : {
         "colspan": 3
        }
     }
  };
};

This doesnt work

dataView.getItemMetadata = function (row) {
  var col = 3;
  return {
    "columns": {
       col : {
         "colspan": 3
        }
     }
  };
};
4

1 回答 1

1

这就是你想要的:

dataView.getItemMetadata = function (row) {
  var col = 3, columns = {};
  columns[col] = { "colspan": 3 }
  return { "columns": columns };
};
于 2013-02-25T23:19:39.167 回答