I am using sap.m.TileContainer to show tiles,
var tileContainer = new sap.m.TileContainer({
tiles: {
path: "/Buttons",
template: new sap.m.StandardTile({
title : "{name}",
visible : "{active}"
})
}
});
My odata service:-
{
d: [
{
__metadata: {
id: "http://host/Service.svc/Buttons(2)",
},
ID: 2,
DisplayName: "Work",
Active: true
},
{
__metadata: {
id: "http://host/Service.svc/Buttons(3)",
},
ID: 3,
DisplayName: "In",
Active: true
}
]
}
working fine.
Now when I changed the Active in OData model of 1st tile to false, I don't get any tiles on the UI.
Error as -
Uncaught TypeError: Cannot read property '$' of undefined
Again I tried changing the 2nd tile Active to false and 1st one to true, which working fine, showing the 1st tile and hiding the 2nd one.
Please help, Thank you
Added Version And error msg-
SAPUI5 Version 1.34.8,
Core Version 1.34.8 (built at 20160226-0945, last change )
Related
I need help figuring this out
debug: ⛔️ Server wasn't able to start properly.
[2022-09-22 11:30:06.580] error: Cannot read property 'routes' of undefined
TypeError: Cannot read property 'routes' of undefined
at Object.addCreateLocalizationAction
An error comes up when i add localization option for my strapi plugin and this is the content scheme, i installed the i18n but it still didnt work
module.exports = {
kind: "collectionType",
collectionName: "tests",
info: {
singularName: "test",
pluralName: "tests",
displayName: "test"
},
options: {
"draftAndPublish": true
},
pluginOptions: {
i18n: {
localized :true
}
},
attributes: {
name: {
pluginOptions: {
i18n: {
localized: true
}
},
type: "string",
required: true
},
}
}
I have a form with two chained comboboxes. The first chained combobox dictates the values that appear in the second. I have forceSelection:true on the second combobox so that when a user changes the first combo, the second will be set blank because it no longer will be a valid option. The chained combos function as expected but when I load a record into this form using getForm().loadRecord(record) the value for the first combo is set properly but the second is not unless I set forceSelection:false.
The following fiddle should make things pretty clear: sencha fiddle
Clicking "Load Record" should load in Fruits/Apple, but only Fruits is shown. Clicking "Load Record" a second time achieves the desired result. If you comment out forceSelection: true it works as expected but then the chained combos don't function as desired. Is there anything I'm doing wrong here?
It is not so easy. What is happening when you are running form.loadRecord(rec).
you set the FoodGroup combobox
you set the FoodName combobox. BUT the value is not there, because your filter did not switch to appropriate food groups. That is why commenting force selection helps. (That is why commenting filter also help).
turned on the filter of food names. Store now have new values.
You are clicking the button second time. The first combobox value is the same, filters are not trigged (triggered?), you already have appropriate values in the second store and the value is selected.
How to fix:
The fix is ugly. You can listen on store 'refresh' (it means the filters are triggered) and then set the second value (or set the values again).
Ext.define('Fiddle.view.FormModel', {
extend: 'Ext.app.ViewModel',
alias: 'viewmodel.fiddle-form-model',
stores: {
foodgroups: {
fields: ['name'],
data: [{
foodgroupname: 'Fruits'
}, {
foodgroupname: 'Vegetables'
}]
},
foods: {
fields: ['foodgroupname', 'foodname'],
filters: {
property: 'foodgroupname',
value: '{selectedFoodgroup.foodgroupname}'
},
data: [{
foodname: 'Apple',
foodgroupname: 'Fruits'
}, {
foodname: 'Banana',
foodgroupname: 'Fruits'
}, {
foodname: 'Lettuce',
foodgroupname: 'Vegetables'
}, {
foodname: 'Carrot',
foodgroupname: 'Vegetables'
}]
}
}
});
Ext.define('Fiddle.view.Form', {
extend: 'Ext.form.Panel',
xtype: 'fiddle-form',
viewModel: {
type: 'fiddle-form-model'
},
title: 'Combos',
items: [{
xtype: 'combo',
itemId: 'FoodGroup', // To access FoodGroup
displayField: 'foodgroupname',
bind: {
store: '{foodgroups}',
selection: '{selectedFoodgroup}'
},
valueField: 'foodgroupname',
forceSelection: true,
name: 'foodgroup',
fieldLabel: 'Food Group',
value: 'Vegetables'
}, {
xtype: 'combo',
itemId: 'FoodName', // To access FoodName
bind: {
store: '{foods}'
},
queryMode: 'local',
forceSelection: true, //COMMENTING THIS OUT ACHIEVES DESIRED LOAD RECORD BEHAVIOR
displayField: 'foodname',
valueField: 'foodname',
name: 'food',
fieldLabel: 'Food',
value: 'Carrot'
}],
buttons: [{
text: 'Load Record',
handler: function (btn) {
// OUR UGLY FIX
var form = btn.up('form'),
foodGroupComboBox = form.down('combobox#FoodGroup'),
foodNameComboBox = form.down('combobox#FoodName'),
record = Ext.create('Ext.data.Model', {
foodgroup: 'Fruits',
food: 'Apple'
});
foodNameComboBox.getStore().on('refresh', function (store) {
form.loadRecord(record);
}, this, {
single: true
})
form.loadRecord(record);
}
}]
});
Ext.application({
name: 'Fiddle',
launch: function () {
var form = new Fiddle.view.Form({
renderTo: document.body,
width: 600,
height: 400
});
}
});
I tried to add data from a JSON response in my collection in meteor. Unfortunately all the things I found on Stack overflow didn't work. In some cases I got an error back like:
Exception in callback of async function: MongoError: Cannot update 'plugins' and 'plugins' at the same time
and if it didn't return an error my object in my collection stayed empty like:
"plugins": {}
The code below is what resulted in an empty object, I hope someone here can help my out.
My collection consist of a field which has an object with multiple objects in it. I want them to be like this
{
"_id" : "id",
"name" : "DemoSite",
"url" : "http://someurl.com",
"createdAt" : ISODate("2016-02-10T17:22:15.011+0000"),
"plugins" :
"Akismet": {
"pluginName" : "Akismet",
"currentPluginVersion" : "3.1.7",
"newPluginVersion" : null,
"lastChecked" : "Thu Feb 18 2016 15:54:02 GMT+0100 (CET)"
},
"Random Plugin": {
"pluginName" : "Random Plugin",
"currentPluginVersion" : "0.1.0",
"newPluginVersion" : null,
"lastChecked" : "Thu Feb 18 2016 15:54:02 GMT+0100 (CET)"
}
}
If my HTTP.call has no error it will do this:
var pluginData = result.data.plugins;
var dbPush = {};
if(pluginData != []){
for (var key in pluginData){
var obj = pluginData[key];
var objKey = obj.Name;
dbPush[objKey] = {
'pluginName': objKey,
'currentPluginVersion': obj.Version,
'newPluginVersion': null,
'lastChecked': new Date()
};
Items.update({_id: item._id}, {$set: {plugins: dbPush}});
}
}
Also my Simple schema has this in it:
Items.attachSchema(new SimpleSchema({
name: {
type: String,
label: "Item name",
min: 4,
max: 100
},
url: {
type: String,
label: "Item url",
autoform: {
afFieldInput: {
type: "url"
}
}
},
createdAt: {
type: Date,
optional: true,
autoValue: function() {
if (this.isInsert) {
return new Date();
} else {
this.unset(); // Prevent user from supplying their own value
}
},
autoform: {
afFieldInput: {
type: "hidden"
}
}
},
plugins: {
type: Object,
optional: true
}
}));
edit
I tried to predefine all the object and then update the collection
dbPush["test"] = {
'pluginName': "test",
'currentPluginVersion': "1.0.0",
'newPluginVersion': null,
'lastChecked': new Date()
};
Items.update({_id: item._id}, {$set: {plugins: dbPush}});
I'm pretty sure this line of code:
Items.update({_id: item._id}, {$set: {plugins: dbPush}});
Is your issue. You're looping through each plugin and updating the exact same MongoDB plugin property on the exact same item for each plugin. I think you want to build the object up beforehand and only insert once:
var pluginData = result.data.plugins;
var dbPush = {};
if(pluginData != []){
for (var key in pluginData){
var obj = pluginData[key];
var objKey = obj.Name;
dbPush[objKey] = {
'pluginName': objKey,
'currentPluginVersion': obj.Version,
'newPluginVersion': null,
'lastChecked': new Date()
};
}
Items.update({_id: item._id}, {$set: {plugins: dbPush}});
}
Right now, you're looping through some amount of times and slowly building that dbPush object.
I found a fix.
It's not a great solution but Simple Schema doesn't allows me to have custom objects in my collection. All that's needed to get this to work with my collection is the blackbox option found in the documentation here.
plugins: {
type: Object,
optional: true,
blackbox: true
}
This will skip validation on the plugins object so it will store the data in the collection.
Thanks for all the help!
I have put together a simple jsfiddle demonstrating the issue. It has a grid with two records. One has a true value in in the Boolean column and the other has a false.
I have logged the data to the console so you can see the values that the grid is getting.
Yet the grid shows false for both rows.
http://jsfiddle.net/codeowl/KhBMT/
Thanks for your time,
Scott
Code for StackOverflow:
var _Data = [
{ "SL_TestData_ID": "1", "SL_TestData_String": "Bool is 1", "SL_TestData_Boolean": "1" },
{ "SL_TestData_ID": "2", "SL_TestData_String": "Bool is 0", "SL_TestData_Boolean": "0" }
];
var _kendoDataSource = new kendo.data.DataSource({
transport: {
read: function (options) {
console.log('Transport READ Event Raised - Data: ', JSON.stringify(_Data, null, 4));
options.success(_Data);
}
},
schema: {
model: {
id: "SL_TestData_ID",
fields: {
SL_TestData_ID: { editable: false, nullable: false },
SL_TestData_String: { type: "string" },
SL_TestData_Boolean: { type: "boolean" }
}
}
},
error: function (a) {
$('#TestGrid').data("kendoGrid").cancelChanges();
}
});
// Initialize Grid
$("#TestGrid").kendoGrid({
columns: [
{ field: "SL_TestData_ID", title: "ID" },
{ field: "SL_TestData_String", title: "String" },
{ field: "SL_TestData_Boolean", title: "Boolean" }
],
dataSource: _kendoDataSource
});
I found that if I altered my select statement to return "TRUE"/"FALSE" for my TINYINT column in the database it worked. Eg;
SELECT
SL_TestData_ID,
SL_TestData_Number,
SL_TestData_String,
SL_TestData_Date,
SL_TestData_DateTime,
if (SL_TestData_Boolean = 1, "TRUE", "FALSE") as SL_TestData_Boolean
FROM
SL_TestData;
Regards,
Scott
I'm new to Sencha, trying to implement a Sencha formpanel with a field to pick from a list of objects in a store. This seems like a sufficiently basic pattern that there must be a simple solution. I have a model which defines an ajax endpoint returning a json array (places) of name/id pairs:
Ext.define('MyApp.model.Place', {
extend: 'Ext.data.Model',
config: {
fields: [
{name: 'name', type: 'string'},
{name: 'id', type: 'int'},
],
proxy: {
type: 'ajax',
url: '/m/places/',
reader: {
type: 'json',
rootProperty: 'places',
},
},
},
});
And a store:
Ext.define('MyApp.store.Place', {
extend: 'Ext.data.Store',
requires: ['MyApp.model.Place'],
config: {
model: 'MyApp.model.Place',
autoLoad: true,
sorters: [
{
property : 'name',
direction: 'ASC',
},
],
},
});
I want a read-only text field for the place name and a hidden field to submit the place id:
{
xtype: 'textfield',
name: 'place_name',
label: 'Place',
readOnly: true,
listeners: {
focus: function () {
var place_picker = Ext.create('Ext.Picker', {
slots: [
{
name: 'place_name',
title: 'Choose a Place',
store: Ext.create('MyApp.store.Place'),
itemTpl: '{name}',
listeners: {
itemtap: function (obj, index, target, record, e, eOpts) {
var form = Ext.getCmp('entityform');
form.setValues({
place_name: record.get('name'),
place_id: record.get('id'),
});
// how to dismiss the picker?
obj.parent.hide();
},
},
},
]
});
Ext.Viewport.add(place_picker);
place_picker.show();
},
},
},
{
xtype: 'hiddenfield',
name: 'place_id',
},
At this point, tapping the field causes the picker to slide up from the bottom and display the loading animation, but it is not being populated with the list of place names, although I can see that the ajax request has been made and that it has returned the expected json document.
I'll stop here and ask if I'm on the right track or is there some better approach out there?
Why isn't the picker being populated with the results of the ajax request? Is my use of itemTpl incorrect?
Am I setting the form fields in a sencha-appropriate way?
How should I dismiss the picker on itemtap? I somehow doubt that my use of hide() is the proper way.
Picker slots has an data config which is an array of objects. It should have a specific format with text and value.
slots :[
data : [{
text : someValue,
value : someValue1,}] ]
You need to add objects which has the fields text and value to slots.