Matthew Tomsho
Matthew Tomsho

Reputation: 275

js-grid adding a insert template causes field to disappear

I have a 7 field grid set up in jsgrid. For one of the fields I need to create an insert template to control entry. Unfortunately, as soon as I add the code, the field no longer appears on the form. None of the fields before and after are affected. Even if I just create the template like this:

insertTemplate: function() {
return;
}

The field disappears. Here are the field parameters entered just before the insertTemplate:

{   title:    "Kab Cost",
    name:     "kab_cost",
    type:     "text",
    align:    "right", 
    editing:  true,
    readOnly: false,
    css:      "grid_small",
    validate: "required",
    width:    5,

I get no javascript errors in the console. If I remove the insert template, the field appears.
I have other fields that are using insert templates with no issue.

Any ideas?

Upvotes: 0

Views: 323

Answers (1)

Matthew Tomsho
Matthew Tomsho

Reputation: 275

Arrghh,

To display the field, the insertTemplate needs a return of the contents (even if blank) I had all of the returns within if statements that could not resolve on initialization of the grid.

Moved the return outside of the if statement and everything went back to normal.

Slapping forehead with hand.

Upvotes: 0

Related Questions