Data.Dataset1.refresh() method does not work in the Smartcafe - smartface.io

After inserting some values to a dataset which is binded to a repeatbox I have used refresh() method but I could not any changes in the repeatbox.
I can only see the changes when the page is load again.
Data.Dataset1.add();
Data.Dataset1.Name = "deneme";
Data.Dataset1.commit();
Data.Dataset1.refresh();
There is any mistake in my codes?

You can use Data.notify("Data.Dataset1");
Try this:
Data.Dataset1.add();
Data.Dataset1.Name = "deneme";
Data.Dataset1.commit();
Data.notify("Data.Dataset1");

Related

PyGObject and Gtk.TreeStore / TreeView - How do I acces the parent element?

I'm working with PyGObject and I successfully setup a TreeStore and a corresponding TreeView. It is just a simple one-column view. It lists all accounts as parents and then you can click the little triangle and it shows the folders. The code looks like this:
accounts_tree_store = Gtk.TreeStore(str)
treeview_accounts = self.builder.get_object("treeview_accounts")
treeview_accounts.set_model(accounts_tree_store)
renderer = Gtk.CellRendererText()
account_iter = accounts_tree_store.append(None, ["Account1"])
accounts_tree_store.append(account_iter, ["Folder1"])
accounts_tree_store.append(account_iter, ["Folder2"])
accounts_tree_store.append(account_iter, ["Folder3"])
accounts_tree_store.append(account_iter, ["Folder4"])
accounts_tree_store.append(account_iter, ["Folder5"])
Then I added this so I can get a selection:
selected_tree = treeview_accounts.get_selection()
selected_tree.connect("changed", Handler().on_tree_select_change)
And my function handler looks like this:
def on_tree_select_change(self, widget, *args):
model, iter = widget.get_selected()
if iter:
print((model[iter][0]))
Now all this works just fine. But I want to also print out the parent of the element that is selected. Something like: "Folder2 for Account4". The question is: How can I access the parent? Is there some sort of "get_parent()" function? I didn't find anything in the docs. Does anyone know how to do this?
Thanks in advance!!
This fuction is called iter_parent and will return parent if iter has one. It's a model's method.
model, iter = widget.get_selected()
parent = model.iter_parent (iter)

How to insert an option value into a select tag with CasperJS?

Well, the question is very self-explanatory.
Right now, I'm front of a form which has a select tag with a couple of options already. But I must insert a new one, with a different value that I will receive from a .json file.
The thing is: I haven't been able to find a suitable solution from the CasperJS documentation.
I've tried something like this:
this.fill('form.coworkerdiscountcode', {
'CoworkerDiscountCode.DiscountCode': ['Value1']
});
But no results. Any ideas?
Thanks in advance.
You can execute any javascript code by passing it to casper.evaluate like this:
casper.evaluate(function() {
var x = document.getElementById("coworkerdiscountcode");
var option = document.createElement("option");
option.text = "Kiwi";
x.add(option);
});

Check if text binded to a control is null

I'm trying to check if I'm binding a null data on a controller. If the data is null, I need to not show the label as well as the binded data.
Below is my code right now.
var oMatNrRow1 = new sap.ui.commons.layout.MatrixLayoutRow();
control1 = new sap.ui.commons.Label({
text : Appcc.getText("MATERIAL_NO") + ":"
});
matrixCell1 = new sap.ui.commons.layout.MatrixLayoutCell();
matrixCell1.addContent(control1);
control = new sap.ui.commons.Label();
control.bindProperty("text", "matnr");
matrixCell1.addContent(control);
oMatNrRow1.addCell(matrixCell1);
vendorTable.addRow(oMatNrRow1);
I have tried control.getProperty("text") but it only returns null when it should have return a number if matnr is not null.
I also tried formatter. I will have no problem with formatter if matnr is not null. But if it is null, the point is to destroy/delete contents of both matrixCell1 instances. In my code below, addition of matrixCell1 content will still push through.
...
formatter: function(matnr){
if (matnr !== ''){
return contract
} else{
matrixCell.destroyContent();
}
});
matrixCell1.addContent(control);
oMatNrRow1.addCell(matrixCell1);
vendorTable.addRow(oMatNrRow1);
Not sure if you can move the ff code inside if statement
matrixCell1.addContent(control);
oMatNrRow1.addCell(matrixCell1);
vendorTable.addRow(oMatNrRow1);
Any ideas are appreciated.
I would also suggest to user the visible property.
Are you aware of conditional binding of UI5? Using them you do not need the formatter at all in that case. see
Found a workaround on my issue. It was a simple if else condition. For the if statement, I just added data[j].matnr and it worked! I also noticed that this was how SAP implemented the behavior also e.g. oSearchViewData.description.

GWT incubator table data ordering issue

I have implemented a gwt incubator table following the example at http://zenoconsulting.wikidot.com/blog:17
this works great however, the order of rows is not same as it is passed using the list object.
the data in this example is set in the following part of the code:
public long showMessages(ArrayList<Message> list) {
long start = System.currentTimeMillis();
// update the count
countLabel.setText("There are "+ list.size() + " messages.");
// reset the table model data
tableModel.setData(list);
// reset the table model row count
tableModel.setRowCount(list.size());
// clear the cache
cachedTableModel.clearCache();
// reset the cached model row count
cachedTableModel.setRowCount(list.size());
// force to page zero with a reload
pagingScrollTable.gotoPage(0, true);
long end = System.currentTimeMillis();
return end - start;
}
Please provide some solution to fix this issue.
awesome! thank you! somehow i ignored this part and internally down the line code was using a hashMap to manage table data which obviously does not retain the sort order. i changed it to linkedHashMap and it worked

How to display content of an ArrayController inside a CollectionView

I am trying to understand how Ember.CollectionView works and I am having a basic issue with displaying the content of my ArrayController in the DOM. Here is my little jsfiddle experiment so you can see for yourself. Here is the coffeescript:
window.App = Ember.Application.create()
window.App.initialize()
App.Item = Em.View.create
tagName:'li'
willInsertElement: () ->
console.log "I **WILL** indert the element", this.$()
didInsertElement: () ->
console.log "I **DID** insert the element", this.$()
template: Ember.Handlebars.compile("~~ {{view.content.title}} ~~")
App.items = Em.ArrayController.create()
App.items.set('content',[
Em.Object.create({title:"AN"}),
Em.Object.create({title:"Epic"}),
Em.Object.create({title:"View"})
])
App.epicView = Ember.CollectionView.create
classNames: ['epic-view']
contentBinding: 'App.items'
itemViewClass: 'App.Item'
App.epicView.appendTo('body')
As you can see in the output of that fiddle, I have not been able to figure out how to access and display the title of objects in the list. When I append the view to body using the call to App.epicView.appendTo('body') it seems to iterate over the three objects but does not print anything.
Any ideas what am I missing here?
ps: I am using Ember 1.0pre
I would simply do something like this: http://jsfiddle.net/Sly7/nevW2/67/
Declare your views (with extend) instead of instantiate them (with create)