Hi Team, Somebody know how to update data from the button in the mobile app?
Like
Federico Buffa ?,
Hi,
Try using the following code to save the record value (for example using the following code I've renamed a contact):
var name = record.get("Name"); var columnName = record.self.PrimaryDisplayColumnName; record.set("Name", name + " renaming method"); record.save({ queryConfig: Ext.create("Terrasoft.QueryConfig", { modelName: record.self.modelName, columns: [columnName] }), failure: this.onViewError }, this);
Please note that columns from the queryConfig is an array and you can pass an array of column names here (and column names are stored inside the record.self.ColumnConfigs.keys).
As for refreshing the page - not sure if it's possible in the context of the button click handler function execution.
Best regards,
Oscar
Hi Bogdan, Sure. I have a button created in the preview page and I want to change a value of that record once the button is press, in this case is to change the status to pending to approval. I have my button like this but I don't know how to save the update record and refresh the page.
Ext.define("Terrasoft.controls.CustomRecordPanelItem", { extend: "Terrasoft.RecordPanelItem", xtype: "cftestrecordpanelitem", config: { items: [ { xtype: "container", layout: "hbox", items: [ { xtype: "button", cls: "btn", id: "clickMeButton", text: '<div style="color: white; background-color: #8ecb60; padding-top: 2%; padding-bottom: 2%;">SUMMIT FOR APPROVAL</div>', flex: 5 } ] } ] }, initialize: function() { var clickMeButton = Ext.getCmp("clickMeButton"); clickMeButton.element.on("tap", this.onClickMeButtonClick, this); }, onClickMeButtonClick: function() { var record = this.getRecord(); // I need to update here the record. Terrasoft.MessageBox.showMessage(record.getPrimaryDisplayColumnValue()); } });
Federico Buffa ?,
Hi,
Try using the following code to save the record value (for example using the following code I've renamed a contact):
var name = record.get("Name"); var columnName = record.self.PrimaryDisplayColumnName; record.set("Name", name + " renaming method"); record.save({ queryConfig: Ext.create("Terrasoft.QueryConfig", { modelName: record.self.modelName, columns: [columnName] }), failure: this.onViewError }, this);
Please note that columns from the queryConfig is an array and you can pass an array of column names here (and column names are stored inside the record.self.ColumnConfigs.keys).
As for refreshing the page - not sure if it's possible in the context of the button click handler function execution.
Best regards,
Oscar
var record = this.getRecord(); if (record.data.AgilizExpenseStatus.data.Id != "0bbc321a-77cd-4d20-a929-b5bbb34c74bc") { record.set("AgilizExpenseStatus", "0bbc321a-77cd-4d20-a929-b5bbb34c74bc"); record.save({ queryConfig: Ext.create('Terrasoft.QueryConfig', { modelName: record.self.modelName, columns: ['AgilizExpenseStatus'] }), success: function() { Terrasoft.MessageBox.showMessage(LocalizableStrings.SummitForApproval); }, failure: function(exception) { Terrasoft.MessageBox.showException(exception); } }, this); }