Update the backform control to support sql-fields.

Following are the enhancements:
1. Added border to control which was missing earlier.
2. Allows user to provide height to sql-field control by specifying extraClasses field in model schema.
3. Defined new classes for sql-field control height in overrides.css
4. Added scrollbar to the control.

Usage:

{
  id: 'definition', label:'{{ _("Definition") }}', cell: 'string',
  type: 'text', mode: ['create', 'edit'], group: 'Definition',
  control: Backform.SqlFieldControl, extraClasses:['custom_height_css_class']
}
This commit is contained in:
Surinder Kumar
2016-03-22 16:36:54 +00:00
committed by Dave Page
parent b3c625f135
commit 03349f4af6
2 changed files with 57 additions and 2 deletions

View File

@@ -1754,12 +1754,27 @@
defaults: {
label: "",
extraClasses: [],
extraClasses: ['sql_field_height_300'], // Add default control height
helpMessage: null,
maxlength: 4096,
rows: undefined
},
// Customize template to add new styles
template: _.template([
'<label class="<%=Backform.controlLabelClassName%>"><%=label%></label>',
'<div class="<%=Backform.controlsClassName%> sql_field_layout <%=extraClasses.join(\' \')%>">',
' <textarea ',
' class="<%=Backform.controlClassName%> " name="<%=name%>"',
' maxlength="<%=maxlength%>" placeholder="<%-placeholder%>" <%=disabled ? "disabled" : ""%>',
' rows=<%=rows%>',
' <%=required ? "required" : ""%>><%-value%></textarea>',
' <% if (helpMessage && helpMessage.length) { %>',
' <span class="<%=Backform.helpMessageClassName%>"><%=helpMessage%></span>',
' <% } %>',
'</div>'
].join("\n")),
/*
* Initialize the SQL Field control properly
*/