标签: extjs

编辑前和编辑 EXTJ

我试图在可编辑网格中将记录从 EXT js 中的 a 传递beforeedit到 a edit,因为我需要根据该字段的先前值进行验证。例如,我有行(电话号码),当我尝试编辑该字段时,只有电话以 6 开头时我才能执行此操作,但如果电话以 9 开​​头我只能将其更改为另一个以 9 开​​头的电话。

我在代码中使用 next ,但我不知道如何将编辑之前的值传递给编辑函数。这是我的代码:

   listeners: {

         beforeedit: {
             scope: this,
             fn: function(e, context2){
                 var record2= context2.record;
                 var recordData2=record2.getData();
                 alert(JSON.stringify(recordData2));
             }

         },

         edit: function(e, context){

             var record = context.record;
             var recordData = record.getData();
             recordData.Funcionalidad = 'Modificar';
             alert(JSON.stringify(recordData));
             Ext.Ajax.request({
                 url: 'http://localhost:8080/MyMaver/ServletTablaLotes',
                 method: 'POST',

                 // merge row data with other params
                 params: recordData


             });
         }
        }
Run Code Online (Sandbox Code Playgroud)

如何将先前的值引用到 edit:function ?

extjs

0
推荐指数
1
解决办法
5835
查看次数

如何更改 Ext.MessageBox 消息中的行?

如何更改 Ext.MessageBox 消息中的行?

if (duplicatedRecords.length > 0) {

    var msg = '';

    duplicatedRecords.forEach(function(element) {
        msg += ' - ' + element.get('ClientName') + '\n';
    });

    Ext.MessageBox.show(
    {
        title: 'Record(s) already exists',
        msg: msg,
        icon: Ext.MessageBox.ERROR,
        buttons: Ext.Msg.OK,
        closable: false
    });

}
Run Code Online (Sandbox Code Playgroud)

我尝试过使用 '\n' 但不起作用......

在此输入图像描述

javascript extjs messagebox

0
推荐指数
1
解决办法
3534
查看次数

ExtJS 中组件被销毁后引用变量会发生什么?

ExtJS 新手。我有以下代码。

var comp;
console.log('comp is - ' + comp);
comp = Ext.create('Ext.Component', {
    listeners : {
        beforedestroy : function(comp) {
            console.log('beforedestroy .. ');
        },
        destroy : function(comp) {
            console.log('destroy .. ');
        }
    }
});
console.log('comp is - ' + comp);
console.log('comp id is - ' + comp.getId());
comp.destroy();
console.log('comp is - ' + comp);
console.log('comp id is - ' + comp.getId());
Run Code Online (Sandbox Code Playgroud)

chrome 的控制台输出是

comp is - undefined
comp is - [object Object]
comp id is - component-1009
beforedestroy .. …
Run Code Online (Sandbox Code Playgroud)

javascript extjs

0
推荐指数
1
解决办法
851
查看次数

ExtJS 6 - 将代理数据绑定到表单

我有一个从 Web 服务中检索信息的代理存储,我想以一种类似于网格的方式在面板中显示该信息,在其中我设置了“dataIndex”参数以绑定到检索到的数据中。

我怎样才能在没有额外编码的情况下实现这个目标,这可能吗?

像这样的东西:

预期结果

代理店:

Ext.define('MyStore', {

  extend: 'Ext.data.Store',
  alias: 'store.myStore',
  model: 'myModel',
  autoload: true,

  proxy: {
    type: <wsType>,
    url: <wsUrl>
  },
  scope: this

});
Run Code Online (Sandbox Code Playgroud)

控制板:

Ext.define('<myPanel>', {

   extend: 'Ext.panel.Panel',

   ...

   store: Ext.create(<myStore>),

   ...


   items: [
   {
     xtype: 'titlePanel',
     cls: 'titlePanel',
     html: '<div class="titlePanel"><h1>My Title</h1></div>',
   },
   {
      xtype: 'form',
      layout: 'vbox',
      cls: 'whitePanel',
      items: [
      {
         xtype: 'panel',

         layout: 'column',
         items: [
         {
             xtype: 'displayfield',
             displayField: 'name',
             dataIndex: 'name',
             fieldLabel: Ext.locale.start,
             name: 'start'
        },
   ...
Run Code Online (Sandbox Code Playgroud)

proxy extjs extjs6

0
推荐指数
1
解决办法
3195
查看次数

Ext JS 4.2.1 - 带分页的网格 - 复选框状态丢失

我有一个 ExtJS 网格,它有一个用于(远程)分页的 PagingToolbar,以及一个定义为的复选框列:

{
    dataIndex : 'selected',
    xtype: 'checkcolumn',
    width : 60                      
}
Run Code Online (Sandbox Code Playgroud)

但是,如果我选中一个框然后向前和向后翻页,则不会保存复选框状态 - 所有复选框都未选中。

我想因为商店只包含当前页面的数据(来自服务器),我需要某种方式来存储不在当前数据页面中的行的状态,然后在我返回到该页面时恢复复选框。

是否有最佳实践或在分页时将复选框状态存储在商店中的示例?

javascript checkbox extjs

0
推荐指数
1
解决办法
802
查看次数

在缓冲网格中以编程方式将行滚动到视图中

我有一个缓冲的分组网格,我想滚动查看某一行(我手头有记录和记录/行的索引)。

我已经尝试过无证

grid.getView().scrollRowIntoView(index)
Run Code Online (Sandbox Code Playgroud)

但这仅适用于无缓冲网格,因为它调用

view.getRow(row)
Run Code Online (Sandbox Code Playgroud)

它只返回当前呈现的行,而不是未呈现的行。

是否有我忽略的官方功能可用,或者我还能做些什么来滚动到正确的记录?

javascript extjs extjs6-classic

0
推荐指数
1
解决办法
1212
查看次数

如何将点击处理程序应用于模板内的多个元素 -EXTJS

我想将点击事件应用于span标签内的标签div

items: [

        tpl: new Ext.XTemplate(
         '<div class="test"> Hello world<span class="icon-gear"></span></div>'
         ),
        listeners: {
          'afterrender': function(this) {
               this.el.on('click', this.onClick, this, { delegate: '.test' });
           },
           'click': function() { this.onSpanClick() }

      }]
Run Code Online (Sandbox Code Playgroud)

下面是点击函数:

onClick: function (e) {
   //some stuff here
},

onSpanClick: function() {
 //some stuff here
}
Run Code Online (Sandbox Code Playgroud)

现在,在上述情况下,当单击容器时class="test",它会进入 onClick() 并按预期工作。但是,当单击 span 元素时,它仍然会转到 ,onClick()而不是转到 onSpanClick()。有没有办法区分来​​自不同元素的点击?

谢谢!

javascript extjs

0
推荐指数
1
解决办法
1389
查看次数

ExtJS:如何通过过滤隐藏存储中的特定数据?

我想隐藏从服务器返回的网格上的记录。

我已经设置了一个filteron store 并且可以访问该特定数据,但是我将如何处理隐藏/忽略此记录?

fooStore: {
    ....
    filters: [
         function(item) {
         let me = this;
         let theRecord = item.data.status === MyApp.STATUS; //true

         if (theRecord) {
              console.log(theRecord); //True
              console.log("So filter is here!!")
              //How to hide/ignore/avoid to load this specific data record to load Grid??
            }
         }
    ]
},
Run Code Online (Sandbox Code Playgroud)

返回 JSON;

{
  "success": true,
  "msg": "OK",
  "count": 3,
  "data": [
    { 
      //Filter achives to this record and aim to hide this one; avoid to load this record.
      "id": 102913410,
      "status": …
Run Code Online (Sandbox Code Playgroud)

load extjs store filter

0
推荐指数
1
解决办法
2739
查看次数

Extjs 7 社区版。无法安装 ext-gen

我可以使用以下命令登录 sencha NPM 存储库:

npm login --registry=https://sencha.myget.org/F/community/npm/ --scope=@sencha
Run Code Online (Sandbox Code Playgroud)

它说:

Logged in as stevemc to scope @sencha on https://sencha.myget.org/F/community/npm/.
Run Code Online (Sandbox Code Playgroud)

但是当我使用以下命令安装 ext-gen 时:

npm install -g @sencha/ext-gen
Run Code Online (Sandbox Code Playgroud)

有人告诉我:

403 You are not allowed to access this feed. - GET https://sencha.myget.org/F/community/npm/@sencha%2fext-gen
Run Code Online (Sandbox Code Playgroud)

我已尝试了建议的故障排除操作,即删除.npmrc文件和清理 NPM 缓存。但无济于事。我把它留了一天,看看第二天情况是否发生变化(也许只是某种更新延迟)。但不是。

我现在失去了想法。

javascript extjs npm sencha-cmd extjs7

0
推荐指数
1
解决办法
633
查看次数

将ExtJS3迁移到ExtJS4

我是ExtJS的新手.由于客户端需要ExtJS3代码,我们需要将其转换为ExtJS4.我正在尝试很多,但它没有显示结果.

Html代码:

<html>
<head>
<title>Search Window With Ext JS 4</title>
<link rel="stylesheet" type="text/css" href="ext-4.0.1/resources/css/ext-all.css"/>
<script type="text/javascript" src="ext-4.0.1/ext-all.js"></script>
<script type="text/javascript" src="ext-4.0.1/bootstrap.js"></script>

<script type="text/javascript" src="searchwindow.js"></script>
<script type="text/javascript" src="SearchRegionPan.js"></script>

<body>
<div id="panel" style="padding:10px"></div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

ExtJS代码:searchwindow.js:

Ext.require(['*']);

 Ext.onReady(function(){

     Ext.QuickTips.init();

var SearchRegionPan = new SearchRegionPan();

//************************* SEARCH TAB **************************************
var searchTab = {
                    id          :   'searchTab',
                    border      :   false,
                    //autoHeight    :   true,
                    //title     :   searchTitle,
                    items       :   [SearchRegionPan,
                      {
                        xtype:'label',
                                    text:'',
                                    style:'padding:2px 1px 0 40px;font-weight: bold;color: red;text-align: center;',
                                    itemId  :   'totallabel'
                                    }],
                    title       : …
Run Code Online (Sandbox Code Playgroud)

extjs extjs4 extjs-mvc extjs3

-1
推荐指数
1
解决办法
2402
查看次数