English 中文(简体)
Ext.net 按钮,与ExtJS有直接活动
原标题:Ext.net Button with Directevents to ExtJS
  • 时间:2012-05-25 20:23:59
  •  标签:
  • button
  • extjs

我在Ext.Net有这个按钮:

<ext:Button ID="BtnEliminar" runat="server" Text="<%$ Resources:BaseLocalizedText, General_BotonEliminar%>"
    Icon="Delete" ToolTip="<%$ Resources:BaseLocalizedText, General_TooltipBotonEliminar%>" Disabled="true">
    <Listeners>
        <BeforeRender Handler="aceleradorTeclado(this,  click , LocalizedScript.General_AceleradorTeclado_Eliminar, LocalizedScript.General_AceleradorTeclado_Eliminar_Tooltip);" />
        <Render Handler="asignarPermiso(this,  Eliminar , true);" />
        <Click Handler="GridHandler.eliminar();" />
    </Listeners>
    <DirectEvents>
        <Click Url="~/Terminales/Eliminar/" CleanRequest="true" Complete="GridHandler.refresh()">
            <Confirmation ConfirmRequest="true" Title="<%$ Resources:BaseLocalizedText, General_TituloMensaje%>"
                Message="<%$ Resources:BaseLocalizedText, General_ConfirmacionBorrado%>" />
            <ExtraParams>
                <ext:Parameter Name="Serial" Value="GridHandler.valorColumna( Serial )" Mode="Raw"/>                            
            </ExtraParams>
        </Click>
    </DirectEvents>
</ext:Button>

我发现如何在ExtJS中切入, 但找不到如何添加 DirectEvents:

if (validarPermiso( Eliminar )) {
    topbar.addButton({
        id:  btnEliminar ,
        xtype:  button ,
        text: LocalizedScript.General_BotonEliminar,
        iconCls:  icon-delete ,
        tooltip: LocalizedScript.General_TooltipBotonEliminar,
        handler: function () {
            GridHandler.eliminar();
        }
    });

    // Combinaciones de teclado
    aceleradorTeclado(btnEliminar,  handler , LocalizedScript.General_AceleradorTeclado_Eliminar, LocalizedScript.General_AceleradorTeclado_Eliminar_Tooltip);
}

我怎么能把直接事件加到按钮上?

感谢前卫!

最佳回答

我找到了解决的方法,使用[直觉方法],也许可以帮助别人。

// Boton Eliminar
if (validarPermiso( Eliminar )) {
     topbar.addButton({
     id:  btnEliminar ,
     xtype:  button ,
     text: LocalizedScript.General_BotonEliminar,
     iconCls:  icon-delete ,
     tooltip: LocalizedScript.General_TooltipBotonEliminar,
     handler: function () {
          Ext.Msg.confirm(LocalizedScript.General_TituloMensaje, LocalizedScript.General_ConfirmacionBorrado, function (btn) {
               if (btn == "yes") {

                    // Si existen un registro seleccionado para eliminar
                    if (GridHandler.eliminar()) {
                         // Realiza el llamado al Controller para eliminar
                         Ext.net.DirectMethod.request({
                              url: GetNewPath(GridHandler.getPathEliminar()),
                              cleanRequest: true,
                              params: GridHandler.getPrimaryKey(GridHandler.getRecord()),
                              success: function (result) {
                                   //Ext.Msg.alert( Mensaje , result);
                              },                            
                              eventMask: {
                                   showMask: true,
                                   msg: LocalizedScript.General_Mask_Eliminar
                         }
                    });
               }
          }
          else {
               return false;
          }
     });
 },
});
问题回答

可能最简单的解析方法就是将您的 button 配置为标记( 或代号后), 然后查看页面。 用于创建 ExtJS < code> button 的 JavaScript 配置脚本可以通过查看页面的 html 源( 查看 & gt; 源) 来获取 。

然后您可以取下 extjs 配置脚本并按需要修改 。

另一个选项, 我建议您使用 < code> DirectEvent 调用 < code> [DirectMethod] 。 您可以直接从任何客户端事件处理器调用 < code> [DirectMethod] , 并且更容易设置。

希望这能帮上忙





相关问题
ExtJS load form items/fields from database

I am using ExtJS 3 here. I would like to populate a formpanel from database with fields to be submitted. Basically, I don t know witch fields my form will have and I want to generate all formpanel ...

How to use Ext JS for role based application

I am planning to use Ext JS for a large application. The application s features are role based. When user login, they only see menu and screen features related to them. My server side technology will ...

Dynamically adding a TabPanel to a Panel Region

I have a Panel layout with a TreePanel in one region. A user clicks on an node in the tree and a TabPanel should be displayed in another region with information, editing tools etc. for that tree node....

How to embed Json result within Extjs Panel?

I have some issues with Json result and embed it within the html of the Extjs Panel. Here s that I have managed to get so far. myPanel is embedded within a mainPanel, and I have some shows/hide of ...

Ajax data update. Extjs

I need to keep certain data ( in a grid) up to date and was gonna do a poll to the server every 15 seocnds or so to get the data and refresh the grid, however it feels a bit dirty ( the grid will have ...

Better way to call superclass method in ExtJS

All the ExtJS documentation and examples I have read suggest calling superclass methods like this: MyApp.MyPanel = Ext.extend(Ext.Panel, { initComponent: function() { // do something MyPanel ...

Merged Headers in Ext JS Grid

Is it possible to have two headers in Ext JS grids? I have to show my grid as grouped data.. for example product types and products. In my case I need a grid like this: Field | Product Type A ...

热门标签