I have tried every way but I am missing something...
This is my code :
Mobile.Customer = (function (params) {
var viewModel = {
};
return {
viewModel: viewModel
}
var gridDataSourceConfiguration = [{
"InternalID": 1,
"Code": 'TEST 1',
"Name": 'Test 1 Test 1'
},
{
"InternalID": 4,
"Code": 'TEST 2',
"Name": 'Test 2 Test 2'
},
{
"InternalID": 5,
"Code": 'TEST 3',
"Name": 'Test 3 Test 3'
}];
var dataGrid = $("#gridContainer").dxDataGrid({
dataSource: gridDataSourceConfiguration,
filterRow: {
visible: true,
applyFilter: "auto"
},
searchPanel: {
visible: true,
width: 240,
placeholder: 'Search...'
},
headerFilter: {
visible: true
},
columns: [{
dataField: "InternalID",
width: 30,
caption: "ID"
}, {
dataField: 'Name',
alignment: 'right',
//dataType: 'date'
}, {
dataField: "Code",
alignment: 'right',
// format: "currency"
}
]
}()).dxDataGrid('instance');
var applyFilterTypes = [{
key: "auto",
name: "Immediately"
}, {
key: "onClick",
name: "On Button Click"
}]
$("#useFilterApplyButton").dxSelectBox({
items: applyFilterTypes,
value: applyFilterTypes[0].key,
valueExpr: "key",
displayExpr: "name",
onValueChanged: (function (data) {
dataGrid.option("filterRow.applyFilter", data.value);
}())
}());
$("#filterRow").dxCheckBox({
text: "Filter Row",
value: true,
onValueChanged: (function (data) {
dataGrid.clearFilter();
dataGrid.option("filterRow.visible", data.value);
$(".apply-filter-option").css("display", data.value ? "block" : "none");
}())
}());
})();
It complains at the very first line, so I do not know what to do. Somewhere I have an extra () in or something - I do not know. I am quite new to this code.
Can anyone help please?
EDIT
Thanks for all your responses. I appreciate and understand somewhat what your are saying. I have put the extra () because of searching on google and here and it was suggested more than once.
This is a Devextreme app. The above code is in my accompanying js file for my dxView file that looks like this :
<pre> <div data-options="dxView : { name: 'Customer', title: 'Customer' } " >
<div data-options="dxContent : { targetPlaceholder: 'content' } " >
<div class="autocomplete" data-bind="dxAutocomplete: {
dataSource: gridDataSourceConfiguration,
displayExpr: 'Description',
placeholder: 'Enter Customer Name',
itemTemplate: 'item'
}">
</div>
<div class="apply-filter-option">Apply Filter <div id="useFilterApplyButton"></div></div>
<div id="gridContainer"></div>
<div class="options"><div id="filterRow"></div></div>
</div>
</div></pre>
This code is to set up a datagridview with information and filtering capabilities.