Hello
We have a "Filter" problem runtime generated ListGrid fields , Details :
We create a new DataSource with predefined fields in the below code . REST service returns this fields and some additional fields (they come some generic sqls) and we have
a ListGrid have same fields is DataSource . List grid shows this fields , We can Filter this predefined fields like "Lot1" But filter not works on "ITEM_MASTER..." like additional fields .
Could you please Help?
//We Add additional fields this
data.forEach(function (item) {
for (var key in item) {
//if (key.indexOf("PROP")>0) {
if (!newFields.find("name", key)) {
var newField = {};
newField.name = key;
newField.type = "text";
newField.title = key;
newField.width = 160;
newField.hidden = false;
newField.canFilter = true;
newField.allowFilterOperators = true;
newField.filterOperator = "iStartsWith";
newFields.push(newField);
}
//}
}
});
ListGrid_SkuStok_SearchForm.setFields(newFields);
ListGrid_SkuStok_SearchForm.setData(data);
//DatSource
isc.RestDataSource.create({
ID: "DataSource_SkuStok_SearchForm",
fields: [
{ name: "MARGFK", type: "text", primaryKey: true },
{ name: "MAMADA", type: "text",},
{ name: "Stok", type: "integer", },
{ name: "Lot1", type: "text", },
{ name: "Lot2", type: "text", },
{ name: "Lot3", type: "text", },
{ name: "BIRIM", type: "text", },
//{ name: "ITEM_MASTER_PROP_102", type:"text" },
],
dataFormat: "json",
dataURL: window.location.href + "/SearchForm/getSkuStok",
operationBindings: [{
operationType: "fetch", dataProtocol: "getParams",
requestProperties: {
httpMethod: 'GET',
httpHeaders: { "Authorization": "Bearer " + Common.token },
}
}],
jsonPrefix: "",
jsonSuffix: "",
dataFetchMode: "local",
handleError: function (response, request) {
if (response.httpResponseCode == "401") {
MainHLayout.destroy();
var login = new LoginScreen();
login.createForm("tr-TR");
}
},
});
//List Grid
isc.ListGrid.create(
{
ID: "ListGrid_SkuStok_SearchForm",
width: "100%",
height: "100%",
dataSource: DataSource_SkuStok_SearchForm,
autoFetchData: true,
showFilterEditor: true,
filterOnKeypress: false,
alternateRecordStyles: true,
dataFetchMode: "local",
showRowNumbers: true,
//canDragSelectText: true,
selectionType: "single",
useAllDataSourceFields: true,
filterLocalData: true,
fields: [
{ name: "MARGFK", title: "SKU", width: 100, type: "text", primaryKey: true },
{ name: "MAMADA", title: "Tanım", type: "text", width: 140 },
{ name: "Lot1", title: "Lot1", type: "text", width: 80 },
{ name: "Lot2", title: "Lot2", type: "text", width: 80 },
{ name: "Lot3", title: "Lot3", type: "text", width: 80 },
{ name: "Stok", title: "Miktar", type: "integer", width: 60 },
{ name: "BIRIM", title: "Birim", type: "text", width: 40 },
//{ name: "ITEM_MASTER_PROP_102", type:"text", width: 80 },
//{ name: "ITEM_MASTER_PROP_103", type: "text", width: 80 },
],
rowClick: function (record) {
DataForm_SkuStok_SearchForm.getField("SELECTED").setValue(record.MARGFK);
},
rowDoubleClick: function () {
SaveButton_SkuStok_SearchForm.click();
}
});
We have a "Filter" problem runtime generated ListGrid fields , Details :
We create a new DataSource with predefined fields in the below code . REST service returns this fields and some additional fields (they come some generic sqls) and we have
a ListGrid have same fields is DataSource . List grid shows this fields , We can Filter this predefined fields like "Lot1" But filter not works on "ITEM_MASTER..." like additional fields .
Could you please Help?
//We Add additional fields this
data.forEach(function (item) {
for (var key in item) {
//if (key.indexOf("PROP")>0) {
if (!newFields.find("name", key)) {
var newField = {};
newField.name = key;
newField.type = "text";
newField.title = key;
newField.width = 160;
newField.hidden = false;
newField.canFilter = true;
newField.allowFilterOperators = true;
newField.filterOperator = "iStartsWith";
newFields.push(newField);
}
//}
}
});
ListGrid_SkuStok_SearchForm.setFields(newFields);
ListGrid_SkuStok_SearchForm.setData(data);
//DatSource
isc.RestDataSource.create({
ID: "DataSource_SkuStok_SearchForm",
fields: [
{ name: "MARGFK", type: "text", primaryKey: true },
{ name: "MAMADA", type: "text",},
{ name: "Stok", type: "integer", },
{ name: "Lot1", type: "text", },
{ name: "Lot2", type: "text", },
{ name: "Lot3", type: "text", },
{ name: "BIRIM", type: "text", },
//{ name: "ITEM_MASTER_PROP_102", type:"text" },
],
dataFormat: "json",
dataURL: window.location.href + "/SearchForm/getSkuStok",
operationBindings: [{
operationType: "fetch", dataProtocol: "getParams",
requestProperties: {
httpMethod: 'GET',
httpHeaders: { "Authorization": "Bearer " + Common.token },
}
}],
jsonPrefix: "",
jsonSuffix: "",
dataFetchMode: "local",
handleError: function (response, request) {
if (response.httpResponseCode == "401") {
MainHLayout.destroy();
var login = new LoginScreen();
login.createForm("tr-TR");
}
},
});
//List Grid
isc.ListGrid.create(
{
ID: "ListGrid_SkuStok_SearchForm",
width: "100%",
height: "100%",
dataSource: DataSource_SkuStok_SearchForm,
autoFetchData: true,
showFilterEditor: true,
filterOnKeypress: false,
alternateRecordStyles: true,
dataFetchMode: "local",
showRowNumbers: true,
//canDragSelectText: true,
selectionType: "single",
useAllDataSourceFields: true,
filterLocalData: true,
fields: [
{ name: "MARGFK", title: "SKU", width: 100, type: "text", primaryKey: true },
{ name: "MAMADA", title: "Tanım", type: "text", width: 140 },
{ name: "Lot1", title: "Lot1", type: "text", width: 80 },
{ name: "Lot2", title: "Lot2", type: "text", width: 80 },
{ name: "Lot3", title: "Lot3", type: "text", width: 80 },
{ name: "Stok", title: "Miktar", type: "integer", width: 60 },
{ name: "BIRIM", title: "Birim", type: "text", width: 40 },
//{ name: "ITEM_MASTER_PROP_102", type:"text", width: 80 },
//{ name: "ITEM_MASTER_PROP_103", type: "text", width: 80 },
],
rowClick: function (record) {
DataForm_SkuStok_SearchForm.getField("SELECTED").setValue(record.MARGFK);
},
rowDoubleClick: function () {
SaveButton_SkuStok_SearchForm.click();
}
});
Comment