PDA

View Full Version : [OPEN] [#343] Ext.Msg.prompt too small.



michaeld
Sep 11, 2013, 11:58 AM
I have the following:


<Listeners>
<Click Handler="Ext.Msg.prompt('Url', 'Please enter the url you wish to import.<br/><br/>Make sure this link is to a page you admin.',
function (btn, url) {
if(btn=='ok')
App.direct.DoImport(url);
},'window',false,'https://www.domain.com/');" />
</Listeners>


The problem is the input prompt is tiny and I'd like it to at least expand to the length of the window. How?

michaeld
Sep 11, 2013, 12:12 PM
While I'm here, I'm also getting an exception "Uncaught TypeError: Object #<Object> has no method 'DoImport'.

Here's the code in the code-behind.


[DirectMethod]
public void DoImport( string url ) {
// Do Work...
}


What am I missing?

There is no namespace around my UserControl

Daniil
Sep 11, 2013, 3:15 PM
Hi @michaeld,

There is an open bug for that.
http://www.sencha.com/forum/showthread.php?268825

We created an Issue to track it.
https://github.com/extnet/Ext.NET/issues/343

As for a DirectMethod.

Where is it defined? Page, user control?

michaeld
Sep 12, 2013, 12:00 AM
There is an open bug for that.
http://www.sencha.com/forum/showthread.php?268825

We created an Issue to track it.
https://github.com/extnet/Ext.NET/issues/343


I've seen no work-around, yet there has to be a way to get access to the input field to change it after the fact? I've seen other solutions that do similar but for previous versions. Is there a way to access the created prompt window and set the input field manually?

If your answer is create a true extjs window here or an extnet one that is hidden till I need to access it, okay, let me know.



As for a DirectMethod.

Where is it defined? Page, user control?

User control. The Direct Events in this same user control have no problem firing, just the Direct Method.

michaeld
Sep 12, 2013, 12:40 AM
Here are some more notes on the DirectMethod debugging.

When I trap the exception in the client-side debugger and expand App.direct, I see the following:


App.direct: Object
ctl00_cp_EventUC: Object
DoImport: function (url,config){return Ext.net.DirectMethod.request("DoImport",Ext.applyIf(config || {}, {params:{url:url},control:"ctl00_cp_EventUC",viewStateMode:"enabled"}));}
__proto__: Object
__proto__: Object


I'm guessing the reason it cannot find the Direct Method is because it is under ctl00_cp_EventUC. EventUC is the name that I assign my UserControlID in UserControlLoader.



var ctl = new UserControlLoader( new UserControlLoader.Config() { Path = ctlname } );
ctl.UserControlID = "EventUC";
ProfP.Items.Add( ctl );


I'm suspecting this is another bug/issue related to UserControlLoader not resolving DirectMethod correctly to the right position so App.direct can resolve.

This is what the builder is constructing...


Ext.ns("App.direct");Ext.apply(App.direct, { ctl00_cp_EventUC:{DoImport:function(url,config){re turn Ext.net.DirectMethod.request("DoImport", ...

Daniil
Sep 12, 2013, 7:41 AM
I've seen no work-around, yet there has to be a way to get access to the input field to change it after the fact? I've seen other solutions that do similar but for previous versions. Is there a way to access the created prompt window and set the input field manually?


It is possible by:

Ext.Msg.textField.setWidth(300);

As for DirectMethods in user controls.

The namespace is constructed this way by default:

App.direct.UserControlID.DirectMethodName

To prune the user control's id part please use the DirectMethodProxyID attribute on a class level:
http://examples2.ext.net/#/Events/DirectMethods/ID_Mode/

[DirectMethodProxyID(IDMode = DirectMethodProxyIDMode.None)]
public partial class MyUserControl: System.Web.UI.MasterPage

Or on a method level:

[DirectMethod(IDMode=DirectMethodProxyIDMode.None)]
public void MyDirectMethod()

michaeld
Sep 12, 2013, 11:18 AM
Tried both. Both work. Thank you.