What is the name of the ajax complete event in Telerik Rad Grid? I tried what is in the documentation but I get following error
Parser Error Message: Type 'Telerik.Web.UI.GridClientEvents' does not have a public property named 'OnResponseEnd'.
Source Error:
Line 62: EditMode="EditForms" GridLines="None" Visible="true" OnNeedDataSource="ctlBenefitLimitsGrid_NeedDataSource">
Line 63: <ClientSettings>
Line 64: <ClientEvents OnResponseEnd = "ctlBenefitLimitsGrid_RequestEnd"></ClientEvents>
Line 65: </ClientSettings>
Line 66: <MasterTableView Width="100%" Summary="RadGrid table" AutoGenerateColumns="False"
You can specify an OnResponseEnd method in JavaScript to run when a response is completed:
<ClientEvents OnRequestStart="RequestStart" OnResponseEnd="ResponseEnd" />
Edit:
My fault, in the newer version, it's been moved.
Try adding it to your RadAjaxManager or RadAjaxManagerProxy.
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<ClientEvents OnResponseEnd="responseEnd" />
</telerik:RadAjaxManager>
http://www.telerik.com/help/aspnet-ajax/ajxonresponseend.html
Related
I'm trying to display Twilio data in my template view, list all of the messages sent using the Twilio API for my account. All this in Nativescript-Vue. My code looks like this
<template>
<Page>
<ActionBar title="API TEST/>
<ScrollView>
<StackLayout>
<StackLayout :key="message.sid" v-for="message in myMessages">
<Label :text="message.body" />
<Label :text="message.from" />
<Label :text="message.to " />
</StackLayout>
</StackLayout>
</ScrollView>
</Page>
</template>
<script>
const Twilio = require('twilio');
const client = new Twilio("[my accountSid]","[my authToken]");
export default {
data() {
return {
myMessages: []
}
},
created() {
this.getList();
},
methods:
{
getList() {
client.messages
.list()
.then(messages => messages.forEach(m => this.myMessages.push(m))
)
.catch(err => console.error(err));
}
}
}
</script>
When I run tns run android I get the following error
System.err: An uncaught Exception occurred on "main" thread.
System.err: Unable to create application com.tns.NativeScriptApplication:com.tns.NativeScriptException: Error calling module function
System.err: TypeError: Cannot read property 'split' of undefined
System.err: File: (file:///node_modules\pbkdf2\lib\default-encoding.js:6:47)
Thanks in advance for the help!
Since its occurring in pbkdf2, a cryptographic library, I would wager its an issue with your Twilio authentication information. Make sure you are using the correct values.
I would verify this by isolating the twilio code into its own small testable snippet.
It seems that there is some bug in the pbkdf2 default-encoding.js. You may need to edit the module library
Try open the node_modules\pbkdf2\lib\default-encoding.js:6:47 like the error suggest and add this on top of the file
var process = require('process')
If error still there after adding the line, you may need to post an issue on their github
The issue is when I enter some negative value in the inputBox within the dialog component and the validator throws error something like "Negative numbers not allowed". The dialog now has an error input box marked with red border and I decide to click outside the dialog to close it and reset the input box, but the inputBox is not reset and if I press Esc key or Ok button then only the popupCanceledListener is called and the inputBox is reset. Below is the code which contains a popup with dialog and inputBox within it.
JSF code:
<af:popup contentDelivery="lazyUncached" autoCancel="enabled"
popupCanceledListener="#{pageFlowScope.testBean.handleResetPopup}"
childCreation="deferred" id="testPopup">
<af:dialog type="none" modal="false"
id="Dlg1">
<af:inputText label="DECIMAL PLACES"
columns="2"
validator="#{pageFlowScope.testBean.validateDecimalPlaceValue}"
value="#{pageFlowScope.testBean.decimalPlace}"
id="input1" autoSubmit="true"></af:inputText>
<f:facet name="acceptNFChange">
<af:commandButton text="OK" id="cb1"
actionListener="#{pageFlowScope.testBean.handleOkFromPopup}"
partialSubmit="true"></af:commandButton>
</f:facet>
</af:dialog>
</af:popup>
Bean code:
public void handleResetPopup(PopupCanceledEvent popupCanceledEvent) {
try {
UIComponent component = popupCanceledEvent.getComponent();
RichInputText inputText = (RichInputText)JSFUtil.findComponent(component, "input1");
inputText.resetValue();
} catch (Throwable th) {
this.handleException(th);
}
}
Problem: When clicking outside the dialog to close it and reset the inputbox, the popupCanceledListener is not invoked.
The best way is to use client listener with type popupClosed. Here is example for your code:
<af:popup contentDelivery="lazyUncached" autoCancel="enabled"
popupCanceledListener="#{pageFlowScope.testBean.handleResetPopup}"
childCreation="deferred" id="testPopup">
<af:dialog type="none" modal="false"
id="Dlg1">
<af:inputText label="DECIMAL PLACES"
columns="2"
validator="#{pageFlowScope.testBean.validateDecimalPlaceValue}"
value="#{pageFlowScope.testBean.decimalPlace}"
id="input1" autoSubmit="true"></af:inputText>
<f:facet name="acceptNFChange">
<af:commandButton text="OK" id="cb1"
actionListener="#{pageFlowScope.testBean.handleOkFromPopup}"
partialSubmit="true"></af:commandButton>
</f:facet>
</af:dialog>
<af:clientListener type="popupClosed" method="popupCloseClientListener"/>
<af:serverListener type="popupClosedEvent" method="#{pageFlowScope.testBean.handlePopupClosed}"/>
</af:popup>
then you need to write somewhere in JSF script:
<script>
function popupCloseClientListener(event) {
component = event.getSource();
AdfCustomEvent.queue(component,
"popupClosedEvent",
{payload:component.getSubmittedValue()},
true);
event.cancel();
}
</script> ]]>
In this way you can always correctly handle popup closed event from client. And implement all server logic you need.
The solution provided in this link https://community.oracle.com/thread/4112016 works fine for my scenario.
I am trying to create a UWP app that listens for Bluetooth serial port connections. When I set up the listener in the application (via a button click) I get an exception at the line:
await socketListener.BindServiceNameAsync(
rfcommProvider.ServiceId.ToString(),
SocketProtectionLevel.BluetoothEncryptionAllowNullAuthentication);`
The exception message is:
System.ArgumentException: 'The parameter is incorrect.
'protectionLevel': Only plain sockets are allowed for IP StreamSocketListeners.'
Here is the code:
private async void btnBluetoothServerClick(object sender, RoutedEventArgs e)
{
var rfcommProvider =
await RfcommServiceProvider.CreateAsync(RfcommServiceId.SerialPort);
var socketListener = new StreamSocketListener();
socketListener.ConnectionReceived += OnConnectionReceived;
await socketListener.BindServiceNameAsync(
rfcommProvider.ServiceId.ToString(),
SocketProtectionLevel.BluetoothEncryptionAllowNullAuthentication);
rfcommProvider.StartAdvertising(socketListener);
}
When the protectionLevel parameter SocketProtectionLevel.BluetoothEncryptionAllowNullAuthentication, is changed to, SocketProtectionLevel.PlainSocketas the exception indicates, the new exception message is: System.Exception: 'The specified class was not found. (Exception from HRESULT: 0x8007277D)'.
The application manifest file includes:
<Capabilities>
<Capability Name="internetClient" />
<DeviceCapability Name="bluetooth" />
<DeviceCapability Name="proximity" />
<DeviceCapability Name="serialcommunication">
<Device Id="any">
<Function Type="name:serialPort" />
</Device>
</DeviceCapability>
<DeviceCapability Name="bluetooth.rfcomm">
<Device Id="any">
<Function Type="name:serialPort" />
</Device>
</DeviceCapability>
<DeviceCapability Name="wifiControl" />
</Capabilities>
It seems that this code should work according to the documentation at:
https://learn.microsoft.com/en-us/uwp/api/windows.networking.sockets.streamsocketlistener#Windows_Networking_Sockets_StreamSocketListener_BindServiceNameAsync_System_String_Windows_Networking_Sockets_SocketProtectionLevel_Windows_Networking_Connectivity_NetworkAdapter_
What am I doing wrong?
Just change parameter of the BindServiceNameAsync method,
rfcommProvider.ServiceId.ToString()
to
rfcommProvider.ServiceId.AsString()
then your code snippet will work.
The AsString() method of RfcommServiceId will convert the RfcommServiceId to a string.ToString will return the type which is not the correct parameter for BindServiceNameAsync.
More details please reference the official sample.
How do you add a brand new attribute to a node in an OpenLaszlo XML dataset?
The way to do this is to use the lz.datapointer.setNodeAttribute() function. If you use the setNodeAttribute() function with an attribute name that does not already appear on the node, a new one will be created.
In the sample OpenLaszlo application below, if you press the button titled [displayXML] after you compile the program, you will see the XML dataset before any changes are made does not contain any "fav_saying" attribute.
After you click the [updateAttribute] button to add the favorite saying for Homer via the setNodeAttribute() method, you can then click the [displayXML] button again and you will see that an attribute called 'fav_saying' has been added to the XML dataset.
<canvas height="665" width="1000" layout="axis: x" debug="true">
<dataset name="myData">
<myXML>
<person firstname="Homer" lastname="Simpson" />
<person firstname="Marge" lastname="Simpson" />
<person firstname="Montgomery" lastname="Burns" />
</myXML>
</dataset>
<button text="displayXML">
<handler name="onclick">
Debug.write(canvas.myData.serialize());
</handler>
</button>
<button text="updateAttribute">
<handler name="onclick">
var dp = canvas.myData.getPointer(); // get datapointer to XML data
dp.setXPath('myXML/person[#firstname="Homer"]'); // set xpath to Homer Simpson
dp.setNodeAttribute('fav_saying', 'DOH!');
</handler>
</button>
</canvas>
You will also see that multiple calls to setNodeAttribute() will not add additional 'fav_saying' attributes. If the program used a different value for the saying every time then the value in the 'fav_saying' attribute would change but there would still only be one 'fav_saying' attribute.
Is it possible to do something like this
while (view.mouseover == true) {
preform action
}
I want to have an action repeat for as long as the mouse is over a specific view.
(asked on the laszlo-user mailing list)
Well, it looks like you answered your own question while I was testing my solution to make sure it worked correctly, but here is an alternative solution that works under OpenLaszlo 4.9.0 SWF10 and OpenLaszlo 4.9.0 DHTML run-times:
<canvas width="1000" height="665" debug="true">
<view id="v" bgcolor="0xcccccc" width="200" height="200">
<!--- #param boolean mouseisover: true when the mouse is over -->
<attribute name="mouseisover" type="boolean" value="false" />
<!--- #keywords private -->
<!--- #param lz.Delegate dlgt_repeat: stores the lz.Delegate object -->
<attribute name="dlgt_repeat" type="expression" />
<!--
Called when the 'onmouseover' event occurs
-->
<handler name="onmouseover">
// Step 1) unregister any existing delegate
// mark it for garbage collection
// and prevent its event from triggering:
if (this['dlgt_repeat'])
this.dlgt_repeat.unregisterAll();
// Step 2) update this.mouseisover flag:
if (!this.mouseisover)
this.setAttribute('mouseisover', true);
// Step 3) create an event Delegate and call it
// on the next application idle event:
var objDlgt = new lz.Delegate(this, 'doSomething');
this.setAttribute('dlgt_repeat', objDlgt);
lz.Idle.callOnIdle(this.dlgt_repeat);
</handler>
<!--
Called when the 'onmouseout' event occurs
-->
<handler name="onmouseout">
// Step 1) unregister any existing delegate
// mark it for garbage collection
// and prevent its event from triggering:
if (this['dlgt_repeat'])
this.dlgt_repeat.unregisterAll();
// Step 2) Update this.mouseisover flag:
if (this.mouseisover)
this.setAttribute('mouseisover', false);
</handler>
<!--- #keywords private -->
<!---
Called on application idle event by lz.Idle repeatedly
when the mouse is down.
#param ??? objDummy: required for SWF9+ run-times for methods
called by delegates due to AS3 (ActionScript3 compiler
requirements). Just set default to null to make compiler
happy and ignore...
-->
<method name="doSomething" args="objDummy=null">
<![CDATA[
// Note: CDATA allows '&&' to be used in script below,
// alternatively omit CDATA and use '&&' instead
// of '&&'
// Step 1) Execute your code you want to run here:
if ($debug) Debug.debug('Do something...');
// Step 2): If mouse is still over and the event
// delegate exists then schedule the event to be
// executed upon the next application idle state:
if (this.mouseisover && this['dlgt_repeat'] != null)
lz.Idle.callOnIdle(this.dlgt_repeat);
]]>
</method>
<text text="Move mouse over" />
</view>
</canvas>
Since both ActionScript and JavaScript are single threaded, it's not possible to have a while loop with pauses between each loop iteration. In the SWF10/11 runtime, you need to make sure that the code within each method or function can be executed within one frame (duration depends on the framerate of the SWF clip) of your application.
As a workaround you can use a timer, here is an example:
<canvas debug="true">
<class name="mouseoverview" extends="view"> <attribute name="timer" type="object" value="null" />
<!-- lz.Delegate instance used by the timer -->
<attribute name="timerdel" type="object" value="null" />
<attribute name="timeractive" type="boolean" value="false" />
<!-- milliseconds to pause before each call to doWhileMouseover method -->
<attribute name="tick" type="number" value="500" />
<handler name="onmouseover">
Debug.info('mouseover');
if (this.timeractive == false) {
this.setAttribute('timeractive', true);
this.timerdel = new lz.Delegate( this, "timerCallback" );
this.timer = lz.Timer.addTimer( this.timerdel, this.tick );
// When the timer is activated, do one call to the method
// containing the loop logic. The following calls will be
// handled by the timer and delegate.
this.doWhileMouseover();
}
</handler>
<handler name="onmouseout">
Debug.info('mouseout');
if (this.timeractive) {
this.setAttribute('timeractive', false);
lz.Timer.removeTimer(this.timerdel);
}
</handler>
<method name="timerCallback" args="millis">
if (this.timeractive) {
lz.Timer.resetTimer(this.timerdel, this.tick);
this.doWhileMouseover();
}
</method>
<method name="doWhileMouseover">
Debug.info("This is your virtual while loop for mouseover");
</method>
</class>
<mouseoverview x="100"
y="100"
width="400"
height="400"
bgcolor="#33aaff"
tick="250">
</mouseoverview>
</canvas>
When a mouseover occurs, a timer is started using the timerdel (an instance of lz.Delegate). Then the doWhileMouseover() method is called once directly, and then repeatedly using the timer, as long as no onmouseout event happened.