SAP UI 5 Search clear button - search

When I click on Clear search(cross) it take 30 sec to clear search text why it work slowly.
Please help me to resolve problem.
<SearchField id="idSoldSearch" search="onSoldSearch" width="100%" />
here I bind data through web service at onSoldSearch function.

When you click on the cross button of Search, it will also trigger the event handler of onSoldSearch, then it will trigger a web service call with the search value empty. It will take 30 sec to make a round trip .You can open the Chrome F12 developer tool to monitor the Network call time.
If you really want to make the WebService call when the search value is empty, You can show a busy dialog.
onSoldSearch:function(oEvent) {
var sQuery = oEvent.getParameters().query;
//adjust following code based on your real code
var onSuccess = function(oResponse) {
//some logic
this.hideBusyDialog();
}
var onError = function(oResponse) {
//some logic
this.hideBusyDialog();
}
webService.call("YourWebServiceurl?"+query,onSuccess,onError);
this.showBusyDialog();
}
Please see the example about BusyDialog.

Related

How to initialize Chrome extension context menus under Manifest V3 service workers? [duplicate]

I'm working on a simple link sharing extension (pinboard, readability, delicious, etc), and have a question about how to properly deal with a context menu item. In my non-persistent background page I call chrome.contextMenus.create and chrome.contextMenus.onClicked.addListener to setup/respond to the context menu.
The context menu entry works as expected. But the background page is showing the following error (right after it starts and before I've used the entry) :
contextMenus.create: Cannot create item with duplicate id id_share_link at chrome-extension://.../share.js:52:30 lastError:29 set
This made me realize that at no point do I remove the item or the listener. Knowing little about javascript and extensions, I'm left wondering if I'm doing everything correctly. I'm assuming this top-level code is going to re-execute every time the background page is invoked. So there are going to be redundant calls to create and addListener (and hence the error I see being logged).
I clearly can't do cleanup in response to suspend, as these calls need to be present to wake up the background script.
Should I be handling things differently?
If you want to use an event page, ie a non-persistent background page, as you call it, you should register a context menu via contextMenus.create in the event handler of runtime.onInstalled, as these context menu registrations ”persist“ anyways.
You have to add the listener-function for the contextMenus.onClicked event every time the event page gets reloaded, though, as the registration of your wish to listen on that event persists, while the handler callback itself does not. So generally don't call contextMenus.onClicked.addListener from runtime.onInstalled, but from top level or other code, that is guaranteed to be executed each time the event page loads.[1]
You can handle it one of two ways:
You can add the context menu and the listeners on install using:
chrome.runtime.onInstalled.addListener(function() {
/* Add context menu and listener */
});
You can remove the context menu and listener, and then re-add it each time the file is called.
[solution may no longer be the case, read comment]
runtime.onInstalled is not triggered if you disable/enable your extension.
My solution is to always add menu items and swallow errors:
'use strict';
{
let seqId = 0;
const createMenuLinkEntry = (title, tab2url) => {
const id = (++seqId).toString();
chrome.contextMenus.create({
id: id,
title: title,
contexts: ['browser_action'],
}, () => {
const err = chrome.runtime.lastError;
if(err) {
console.warn('Context menu error ignored:', err);
}
});
};
createMenuLinkEntry('Go to Google', (tab) => 'https://google.com');
createMenuLinkEntry('Go to GitHub', (tab) => 'https://github.com');
} // namespace

Chrome screen sharing get monitor info

I implemented chrome extension which using chrome.desktopCapture.chooseDesktopMedia to retrieve screen id.
This is my background script:
chrome.runtime.onConnect.addListener(function (port) {
port.onMessage.addListener(messageHandler);
// listen to "content-script.js"
function messageHandler(message) {
if(message == 'get-screen-id') {
chrome.desktopCapture.chooseDesktopMedia(['screen', 'window'], port.sender.tab, onUserAction);
}
}
function onUserAction(sourceId) {
//Access denied
if(!sourceId || !sourceId.length) {
return port.postMessage('permission-denie');
}
port.postMessage({
sourceId: sourceId
});
}
});
I need to get shared monitor info(resolution, landscape or portrait).
My question is: If customer using more than one monitor, how can i determine which monitor he picked?
Can i add for example "system.display" permissions to my extension and get picked monitor info from "chrome.system.display.getInfo"?
You are right. You could add system.display permission and call chrome.system.display.getDisplayLayout(callbackFuncion(DisplayLayout)) and handle the DisplayLayout.position in the callback to get the layout and the chrome.system.display.getInfo to handle the array of displayInfo in the callback. You should look for 'isPrimary' value
This is a year old question, but I came across it since I was after the same information and I finally managed to figure how you can identify which monitor the user selected for screen-sharing in Chrome.
First of all: this information will not come from the extension that you probably built for screen-sharing in Chrome, because:
The chrome.desktopCapture.chooseDesktopMedia API callback only returns a sourceId, which is a string that represents a stream id, that you can then use to call the getMediaSource API to build the media stream.
The chrome.system.display.getInfo will give you a list of the displays, yes, but from that info you can't tell which one is being shared, and there is no way to match the sourceId with any of the fields returned for each display.
So... the solution I've found comes from the MediaStream object itself. Once you have the stream, after calling getMediaSource, you need to get the video track, and in there you will find a property called "label". This label gives you an idea of which screen the user picked.
You can get the video track with something like:
const videoTrack = mediaStream.getVideoTracks()[0];
(Check the getVideoTracks API here: https://developer.mozilla.org/en-US/docs/Web/API/MediaStream/getVideoTracks).
If you print that object, you will see the "label" field. In Chrome screen 1 shows as "0:0", whereas screen 2 shows as "1:0", and I assume screen i would be "i-1:0" (I've only tested with 2 screens).
Here is a capture of that object printed in the console:
And not only works for Chrome, but for other browsers that implement it! In Firefox they show up as "Screen i":
Also, if you check Chrome chrome://webrtc-internals you'll see this is what they show in the addStream event:
And that's it! It's not ideal, since this is a label, more than a real screen identifier, but well, it's something to work with. Once you have the screen identified, in Chrome you can work with the chrome.system.display.getInfo to get information for that display.

Why won't my suitescript deploy scripts fire?

I don't know when this started, but I think it happened after I did some refactoring using the IDE with renaming.
Anyway, if I attach the script through the form, they fire. However, my user event, nor client scripts fire though there is a deployment record. That deployment record uses the same script that works IF it is attached via the form custom code area.
What happened?
EDIT:
For Instance:
Trying to add a button to opportunity:
function userEventBeforeLoad(type, form, request){
var list = form.getSubList("item");
list.addButton('custpage_customconfigurebutton', 'Configure', 'clientStartConfigurator()');
}
Upload Script
Add to "Script"
Deploy:
It never fires when I "Create Opportunity"?
NONE of my user event scripts are firing
EDIT 2 (NEW SCREENS as requested
Following lines of code working for me
function userEventBeforeLoad(type, form, request) {
//nlapiLogExecution('error', 'type', type);
var list = form.getSubList("item");
list.addButton('custpage_customconfigurebutton', 'Configure',"alert('Hello World')");
}
I suspect you might have an error in your clientStartConfigurator(). To verify, you can also use the browser console on click of your button to see whether you're successfully returning from your respective function or not.
Hope this will help you.

How can I disable javascript for the page that's being opened?

I was up till 1 am last night trying to find an example of how to do this. My theory is that I'd write a function that would comment out all javascript.
The second option would be to add the url to the list of javascript settings.
Right now my extension is very simple:
function linkOnClick(info, tab) {
window.open(info.linkUrl)
}
chrome.contextMenus.create(
{title: "Load with no Javascript", contexts:["link"], onclick: linkOnClick});
This is my first extension and I'm kind of lost.
edit: let me know if I should also post the manifest.json.
edit: I can't mark this as solved for 2 days (why? who knows.), so I'll probably not remember to mark this as solved. So accept this as the official making: SOLVED.
chrome.contentSettings.javascript.set is the thing that disables javascript.
Here's the part that disables javascript.
(Google, here's what an actual example should look like):
chrome.contentSettings.javascript.set(
{'primaryPattern':AnyDomainName, /*this is a string with the domain*/
'setting': "block", /* block the domain. Can be switched to "allow" */
'scope':'regular'}, /*it's either regular or incognito*/
function(){
/*optional action you want to
take place AFTER something's been blocked'*/
});
Here's the script I used to import into my json script for my chrome extension.
var link=""
var pattern=""
function linkOnClick(info, tab) {
r = /:\/\/(.[^/]+)/;
link=info.linkUrl
pattern="http://"+link.match(r)[1]+"/*"
chrome.contentSettings.javascript.set(
{'primaryPattern':pattern,
'setting': "block",
'scope':'regular'},
function(){
window.open(link)
});
}
chrome.contextMenus.create({title: "Load with no Javascript", contexts:["link"], onclick: linkOnClick});
I couldn't tell how any of this worked by reading the developer.chrome.com page! They really need add complete working examples or allow a way for users to add examples. I can't even use it. The git hub link is what saved me.

Auto Refresh the List in Sencha Touch Application

I am developing an simple Chat Application, I can view the updated data when I click on the REFRESH Button, BUT can I refresh the data at a regular interval from the Server (as my Chat is getting Stored in the Database remotely)
Thanks in advance.
Use DelayedTask class of Sencha Touch:
//create the delayed task instance with our callback
var task = Ext.create('Ext.util.DelayedTask', function() {
//load the list's store here. The list will be automatically updated
listComp.getStore().load(); // Assuming your list component is "listComp"
listComp.refresh();
// The task will be called after each 10000 ms
task.delay(10000);
}, this);
//The function will start after 0 milliseconds
//so we want to start instantly at first
task.delay(0);
//to stop the task, just call the cancel method
//task.cancel();
This should work for your case.
You just need to call your refresh() function at a regular right ?
So you just need to add a setTimeout("refresh()", 1000); at the end of your refresh() function. Then you just need to call it when your app startup.
Hope this helps
Maybe you'll be interested in socket server connection in your chat application. Server will notify your clients whenever server data changes. Take a look at http://socket.io/
please look at this.
It will call the function for every (time you set).
http://www.sencha.com/forum/showthread.php?194202-Autorefresh-List-with-DelayedTask

Resources