Is the empty result message of a ValueHelpDialog customizable somehow? - sapui5

I have to customize the empty result message of a search result of a ValueHelpDialog. Is this possible somehow?

You could try fetching the table control via getTableAsync from the value help dialog:
this._oValueHelpDialog.getTableAsync().then(function (oTable) {
oTable.setNoData("No Data text"); // sap.ui.table.Table
});
API reference: sap.ui.comp.valuehelpdialog.ValueHelpDialog#getTableAsync

Related

How to make Grafana's datasource plugin compliant with Query Inspector?

I'm developping a datasource plugin for Grafana that works nicely but if I try to use the Query Inspector, I only get the following message "Loading query inspector... ".
So how to make my plugin compliant with this feature? Is there any specific function to add to my datasource.ts file ?
[edit]
I'm using Grafana 6.7.1 and #grafana/toolkit
Thanks for your help
Finally , I think I understood how it works.
The query inspector is triggered only if an event (dsRequestResponse or dsRequestError) is emitted after the query is done by the backend server (see code documentation)
For example :
import { getBackendSrv } from '#grafana/runtime';
//later in your code
getBackendSrv().datasourceRequest({
url:'https://api.github.com/repos/grafana/grafana/stats/commit_activity',
method:'GET'
}).then((data: any) => console.log('DATA',data));
In my datasource, I'm doing fetch() call from the browser so no event is emitted and then no data are displayed in the query inspector. But here is a workaround to emit the event :
import { SystemJS } from '#grafana/runtime'
//later in your code
SystemJS.load('app/core/app_events').then((appEvents:any) => {
appEvents.emit('ds-request-response', data) // where data is the data to display
})
I hope it can help someone else

Meteor Blaze Templates Data Context in onCreated

I am reading in several places that I should be able to get the data context of the current template with Template.currentData();
I found that it seems to only work within an autorun. But after logging the data as a variable there, first it logs null, then it logs the data in the console.
When I try to use the data, like for example trying to pass data._id into a subscription, I get a TypeError in the console. TypeError: Cannot read property '_id' of null. So for some reason, the data is null and I am struggling to find out why.
I have the data context set within my routes using Iron Router:
Router.route('/stock/:stockNumber', {
name: 'stock.detail',
template: 'StockDetail',
data: function () {
return Stock.findOne({
stockNumber: this.params.stockNumber*1
});
}
});
What I am trying to do is get access to the data context so that I can pass some things from it, such as the '_id' into some other subscriptions. What am I doing wrong?
The template is otherwise correctly displaying the data on the page as expected, and I can use Spacebars to show things like {{_id}} for example. But again, I seem to be unable to get access to the data context in Template.StockDetail.onCreated
Ok, so here's what I ended up doing...
Apparently the data context is just simply not available in the onCreated, period. What I had to do was do a Collection.findOne() within the autorun to find the stockItem and set the result to a variable, then use the stockItem._id as the parameter in the new subscription IF the item was found. With both of these things, it seems to work just fine.
Template.StockDetail.onCreated(function () {
let instance = this;
instance.autorun(function () {
instance.subscribe('stock_item', Router.current().params.stockNumber);
let stockItem = Stock.findOne({ // This is what was needed for some reason...
stockNumber: Router.current().params.stockNumber*1
});
if (stockItem) { // ...and, also, this was needed
instance.subscribe('stock_item_scan_log', stockItem._id);
}
});
});
I just don't understand why I can't just easily get the _id some other way. This way just feels incorrect and I don't like it.

parse.com set undefined to date field in data browser

How can I set undefined or null and make empty to a date field in the parse.com data browser.
There is nothing related with code, in the pic i attached, you can see the parse.com data browser and i want to set undefined or null whatever and make that field empty but whenever i tried and double click the cell, data browser open date widget and it is not allowed to delete the data or there is no button to make empty.
Parse.com Data Browser
In data-browser I don't think it's possible to delete a date value, I couldn't find a way to do it at least.
And now that Parse.com will not be maintained anymore(in 01/01/2017 it will shut down), I don't think this may come up as a feature.
My solution to this problem was to make a request to this register and use unset. It gets a bit more of work but solves the problem.
I don't know if you're using parse with Javascript but it can be really easy to adapt to other enviroments.
In Javascript this script should do the trick:
var DateUpdate = Parse.Object.extend("MyTableOnParse");
var dateUpdateEdit = new Parse.Query(DateUpdate);
dateUpdateEdit.equalTo("objectId",myObjectId);
dateUpdateEdit.first({
success: function(object)
{
object.unset("saleDate");
object.save({
success: function(updatedObject)
{
console.log("Data deleted");
}
})
}
});

How do I format HTML code in Code Mirror when the value is set to it?

I am using the Code Mirror plugin to edit HTML source of a page. The HTML code is fetched from database and set as value in Code Mirror. But, after setting the value it is displayed in the same format in which it was saved in the database. How can I display it in proper format? Thanks in advance.
There is a function called autoFormatRange
editor.autoFormatRange(range.from, range.to);
This fragment from the CodeMirror Group might be what you need:
function autoFormat() {
var totalLines = editor.lineCount();
var totalChars = editor.getTextArea().value.length;
editor.autoFormatRange({line:0, ch:0}, {line:totalLines, ch:totalChars});
}
http://codemirror.net/2/demo/formatting.html

Smart Gwt List Grid:How to check selected records

I am using smart gwt 2.5 List grid.
In this I am using check box for simple selection.below is the code for that:
getGrid().setSelectionAppearance(SelectionAppearance.CHECKBOX);
getGrid().setSelectionType(SelectionStyle.SIMPLE);
I am using data source for the list grid.For feeding data calling this method:
public void setTestData(DataClass[] testData) {
setAttribute("testData", testData, true);
}
My grid is rendering data properly.Now I want to set checked some of records (Row) depending in some condition.Lets say I want row number 1 and 5 should be checked.
For this after feeding data to data source I write code like below to check data:
getGrid().selectRecord(1);`
getGrid().selectRecord(5);
But is not doing any checked operations to check box.I am not getting at what point I am doing mistake.
same thing when I tried with out data source and I feed data to list grid simply by setdata It was working.
Please help me out.Thanks in advance
When you use a DataSource, including a clientOnly DataSource, fetching data is asynchronous, so your selectRecord() calls are happening when data is not loaded yet. Wait for DataArrived before attempting to select records.
One work around which is working for me is that:
I removed selection appearance and selected type from my grid and took a column for check box
like below:
NTListGridField customCheckBoxField = new NTListGridField("select", "Select", 25);
customCheckBoxField.setAlign(Alignment.LEFT);
customCheckBoxField.setType(ListGridFieldType.BOOLEAN);
customCheckBoxField.setCanFilter(false);
customCheckBoxField.setCanEdit(true);
customCheckBoxField.setCanToggle(true);
Now for selecting records,
record.setAttribute("select", true);