This is a migrated thread and some comments may be shown as answers.

Grid Column Template and filtering

1 Answer 79 Views
Grid
This is a migrated thread and some comments may be shown as answers.
MOTASH
Top achievements
Rank 1
MOTASH asked on 03 May 2018, 01:18 AM

Hello,

I'm building a dynamic grid (Datasource Model,Columns are built as js objects),my issue is :

I've a column bound to a numeric field and displayed as a checkbox using as per the following code

fields["Fields[" + f + "].Value"] = { type: "number", editable: false, defaultValue: 0 };<br>Columns[i] = { field: "Fields[" + f + "].Value", title: gridModel.Fields[f].FieldName, template: "<input id='checkbox" + f + "' type='checkbox' #=(Fields[" + f + "].Value > 0 ) ? checked='checked' :'' # #=(Fields[" + f + "].ReadOnly > 0 ) ? disabled='disabled' :'' # class='chkbx' />", width: w, editable: false, attributes: { style: "text-align:center;" }, headerAttributes: { style: "text-align:center;", title: gridModel.Fields[f].Details }, footerAttributes: { style: "text-align:center;" }, aggregates: fAggregate, footerTemplate: footerTemplate, groupFooterTemplate: grpFooterTemplateFn };

 

It performs just fine, the problem takes place when i do datasource filtering, the field value is assumed to be a string and therefore an internal javascript exception occurs in the part below

(function anonymous(d, __f, __o
) {
return (((d.Fields[1].Value || '').toLowerCase().indexOf("mads") >= 0 || (d.Fields[2].Value || '').toLowerCase().indexOf("mads") >= 0 || (d.Fields[3].Value || '').toLowerCase().indexOf("mads") >= 0 || (d.Fields[4].Value || '').toLowerCase().indexOf("mads") >= 0 || (d.Fields[5].FieldText || '').toLowerCase().indexOf("mads") >= 0 || (d.Fields[7].Value || '').toLowerCase().indexOf("mads") >= 0 || (d.Fields[8].Value || '').toLowerCase().indexOf("mads") >= 0 || (d.Fields[9].Value || '').toLowerCase().indexOf("mads") >= 0 || (d.Fields[10].Value || '').toLowerCase().indexOf("mads") >= 0 || (d.Fields[11].FieldText || '').toLowerCase().indexOf("mads") >= 0 || (d.Fields[12].FieldText || '').toLowerCase().indexOf("mads") >= 0 || (d.Fields[13].FieldText || '').toLowerCase().indexOf("mads") >= 0 || (d.Fields[18].Value || '').toLowerCase().indexOf("mads") >= 0 || (d.Fields[19].Value || '').toLowerCase().indexOf("mads") >= 0 || (d.Fields[20].Value || '').toLowerCase().indexOf("mads") >= 0 || (d.Fields[21].Value || '').toLowerCase().indexOf("mads") >= 0 || (d.Fields[22].FieldText || '').toLowerCase().indexOf("mads") >= 0 || (d.Fields[23].FieldText || '').toLowerCase().indexOf("mads") >= 0 || (d.Fields[24].Value || '').toLowerCase().indexOf("mads") >= 0 || (d.Fields[26].FieldText || '').toLowerCase().indexOf("mads") >= 0 || (d.Fields[27].Value || '').toLowerCase().indexOf("mads") >= 0 || (d.Fields[28].FieldText || '').toLowerCase().indexOf("mads") >= 0 || (d.Fields[29].Value || '').toLowerCase().indexOf("mads") >= 0 || (d.Fields[30].Value || '').toLowerCase().indexOf("mads") >= 0 || (d.Fields[31].Value || '').toLowerCase().indexOf("mads") >= 0 || (d.Fields[32].Value || '').toLowerCase().indexOf("mads") >= 0))
})

 

if i remove the template from the column definition (it displays 0 and 1) no exception happens,  any suggestions

Regards,

MOTASH

1 Answer, 1 is accepted

Sort by
0
MOTASH
Top achievements
Rank 1
answered on 03 May 2018, 09:40 AM

I'm sorry i misinterpreted the source of the problem, the template had no effect,actually i put a string filter operator 'contains' on this numeric type,once i used a numeric operator 'equal' it worked fine

i hope if an admin can remove the post

Thanks in advance

MOTASH

Tags
Grid
Asked by
MOTASH
Top achievements
Rank 1
Answers by
MOTASH
Top achievements
Rank 1
Share this question
or