A simple question i cant workout. In a column definition whats the difference between the field property and the id property...Fx..
columns.push({ id: "officeId", name: "Office Id", field: "officeId", width: 40 });
When would they be different/why two?
Thanks? Tim
The id
is just a unique identifier for the column. You can set it to anything you want. It's only use is to provide an identifier when you want to refer to your columns from code.
The field
specifies how the column binds to the underlying data. Suppose your data looks like this:
data = [
{ firstName: "John", lastName: "Smith" },
{ firstName: "Fred", lastName: "Jones" }
];
When you define the column you can tell it which value you want to display from your data array.
columns.push({ id: "anythingyoulike", name: "Surname", field: "lastName", width: 40 });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With