Javascript 多选复选框未在Extjs 4.2网格中返回值

Javascript 多选复选框未在Extjs 4.2网格中返回值,javascript,jquery,extjs,Javascript,Jquery,Extjs,我正在为我的应用程序使用Extjs 4.2网格。在我的表格中,有一个选择多行并删除它们的选项(通过复选框)。但我只是选择的行,不返回任何值 下面是我的密码 Ext.Loader.setConfig({enabled: true}); Ext.Loader.setPath('Ext.ux', '../js/extjs_4_2/examples/ux/'); Ext.require([ 'Ext.grid.*', 'Ext.data.*', 'Ext.util.*',

我正在为我的应用程序使用Extjs 4.2网格。在我的表格中,有一个选择多行并删除它们的选项(通过复选框)。但我只是选择的行,不返回任何值

下面是我的密码

Ext.Loader.setConfig({enabled: true});

Ext.Loader.setPath('Ext.ux', '../js/extjs_4_2/examples/ux/');
Ext.require([
    'Ext.grid.*',
    'Ext.data.*',
    'Ext.util.*',
    'Ext.ux.grid.FiltersFeature',
    'Ext.toolbar.Paging',
    'Ext.ux.PreviewPlugin',
    'Ext.ModelManager',
    'Ext.tip.QuickTipManager',
    'Ext.selection.CheckboxModel'
]);

Ext.onReady(function(){
Ext.tip.QuickTipManager.init();

Ext.define('ForumThread', {
    extend: 'Ext.data.Model',
   fields: [

       {name: 'patient_name'},
       {name: 'referrer_provider'},
       {name: 'admit_date'},
       {name: 'added_date'},                  
               {name: 'billing_date'},
       {name: 'dob'},
               {name: 'loc_name'},
       {name: 'physician_name'},
       {name: 'imploded_diagnosis_name'},                  
               {name: 'imploded_procedure_name'},
       {name: 'imploded_optional_name'},
       {name: 'imploded_quick_list_name'},
       {name: 'med_record_no'},
               {name: 'message'}
            ],

    idProperty: 'bill_id'
});

var url = {
    remote: '../new_charges_json.php'
};
// configure whether filter query is encoded or not (initially)
var encode = false;
// configure whether filtering is performed locally or remotely (initially)
var local = false;

// create the Data Store
var store = Ext.create('Ext.data.Store', {
    pageSize: 10,
    model: 'ForumThread',
    remoteSort: true,
    proxy: {
        type: 'jsonp',
        url: (local ? url.local : url.remote),
        reader: {
            root: 'charges_details',
            totalProperty: 'total_count'
        },
        simpleSortMode: true
    },
    sorters: [{
        property: 'patient_name',
        direction: 'DESC'
    }]
});

    var filters = {
    ftype: 'filters',
    // encode and local configuration options defined previously for easier reuse
    encode: encode, // json encode the filter query
    local: local,   // defaults to false (remote filtering)

    // Filters are most naturally placed in the column definition, but can also be
    // added here.
    filters: [{
        type: 'string',
        dataIndex: 'patient_name'
    }]
};

// use a factory method to reduce code while demonstrating
// that the GridFilter plugin may be configured with or without
// the filter types (the filters may be specified on the column model

var createColumns = function (finish, start) {

    var columns = [
        {
            menuDisabled: true,
            sortable: false,
            xtype: 'actioncolumn',
            width: 50,


            items: [{
                icon   : '../js/extjs_4_2/examples/shared/icons/fam/user_profile.png',  // Use a URL in the icon config
                tooltip: 'Patient Profile',
                renderer: renderTopic,
                handler: function(grid, rowIndex, colIndex) {
                    var rec = store.getAt(rowIndex);
                    //alert("Bill Id: " + rec.get('bill_id'));
                    //Ext.Msg.alert('Bill Info', rec.get('patient_name')+ ", Bill Id: " +rec.get('bill_id'));
                    window.location.href="../newdash/profile.php?bill_id="+rec.get('bill_id');
                }
            }, 
        ]
        },
        {
        dataIndex: 'patient_name',
        text: 'Patient Name',
        sortable: true,
        // instead of specifying filter config just specify filterable=true
        // to use store's field's type property (if type property not
        // explicitly specified in store config it will be 'auto' which
        // GridFilters will assume to be 'StringFilter'
        filterable: true
        //,filter: {type: 'numeric'}
    }, {
        dataIndex: 'referrer_provider',
        text: 'Referring',
        sortable: true
        //flex: 1,
    }, {
        dataIndex: 'admit_date',
        text: 'Admit date',
    }, {
        dataIndex: 'added_date',
        text: 'Sign-on date'
    }, {
        dataIndex: 'billing_date',
        text: 'Date Of Service',
        filter: true,
        renderer: Ext.util.Format.dateRenderer('m/d/Y')
    }, {
        dataIndex: 'dob',
        text: 'DOB'
        // this column's filter is defined in the filters feature config
    },{
        dataIndex: 'loc_name',
        text: 'Location',
        sortable: true
    },{
        dataIndex: 'physician_name',
        text: 'Physician (BILLED)',
        sortable: true
    },{
        dataIndex: 'imploded_diagnosis_name',
        text: 'Diagnosis'
    },{
        dataIndex: 'imploded_procedure_name',
        text: 'Procedure'
    },{
        dataIndex: 'imploded_optional_name',
        text: 'OPT Template'
    },{
        dataIndex: 'imploded_quick_list_name',
        text: 'Quick List'
    },{
        dataIndex: 'med_record_no',
        text: 'Medical Record Number'
    },{
        dataIndex: 'message',
        text: 'TEXT or NOTES'
    }



    ];

    return columns.slice(start || 0, finish);
};


var pluginExpanded = true;


var selModel = Ext.create('Ext.selection.CheckboxModel', {

        columns: [
        {xtype : 'checkcolumn', text : 'Active', dataIndex : 'bill_id'}
        ],
    checkOnly: true,
    mode: 'multi',
    enableKeyNav: false,


    listeners: {
        selectionchange: function(sm, selections) {
            grid.down('#removeButton').setDisabled(selections.length === 0);
        }
    }
});

var grid = Ext.create('Ext.grid.Panel', {
    //width: 1024,
    height: 500,
    title: 'Charge Information',
    store: store,
    //disableSelection: true,
    loadMask: true,
    features: [filters],
    forceFit: true,
    viewConfig: {
        stripeRows: true,
        enableTextSelection: true
    },
    // grid columns
    colModel: createColumns(15),

    selModel: selModel,

    // inline buttons
    dockedItems: [
       {
        xtype: 'toolbar',
        items: [{
            itemId: 'removeButton',
            text:'Charge Batch',
            tooltip:'Charge Batch',
            disabled: false,
            enableToggle: true,
    toggleHandler: function() {  // Here goes the delete functionality
                alert(selModel.getCount());
                var selected = selModel.getView().getSelectionModel().getSelections();
                alert(selected.length);
                var selectedIds;
                if(selected.length>0) {
                    for(var i=0;i<selected.length;i++) {
                        if(i==0)
                        {
                                selectedIds = selected[i].get("bill_id");
                        }   
                        else
                        {
                                selectedIds = selectedIds + "," + selected[i].get("bill_id");
                        }
                    }
                }

                alert("Seleted Id's: "+selectedIds);return false;

            }









        }]
    }],



    // paging bar on the bottom
        bbar: Ext.create('Ext.PagingToolbar', {
        store: store,
        displayInfo: true,
        displayMsg: 'Displaying charges {0} - {1} of {2}',
        emptyMsg: "No charges to display"
    }),
    renderTo: 'charges-paging-grid'
});

store.loadPage(1);
});
###########################################################################
Ext.Loader.setConfig({enabled:true});
setPath('Ext.ux','../js/extjs_4_2/examples/ux/);
外部要求([
“Ext.grid.*”,
“Ext.data.*”,
“Ext.util.*”,
“Ext.ux.grid.FiltersFeature”,
“Ext.toolbar.Paging”,
“Ext.ux.PreviewPlugin”,
“Ext.ModelManager”,
“Ext.tip.QuickTipManager”,
“Ext.selection.CheckboxModel”
]);
Ext.onReady(函数(){
Ext.tip.QuickTipManager.init();
Ext.define('ForumThread'{
扩展:“Ext.data.Model”,
字段:[
{name:'患者名称'},
{name:'referer\u provider'},
{name:'承认日期'},
{name:'added_date'},
{name:'billing_date'},
{name:'dob'},
{name:'loc_name'},
{name:'医生名称'},
{name:'内爆的\u诊断\u name'},
{name:'inboded_procedure_name'},
{name:'内爆\u可选\u name'},
{name:'inboded_quick_list_name'},
{name:'med_record_no'},
{name:'消息'}
],
idProperty:“bill\u id”
});
变量url={
远程:“../new\u charges\u json.php”
};
//配置是否对筛选器查询进行编码(最初)
var encode=false;
//配置过滤是本地执行还是远程执行(最初)
var局部=假;
//创建数据存储
var store=Ext.create('Ext.data.store'{
页面大小:10,
型号:“ForumThread”,
remoteSort:是的,
代理:{
键入:“jsonp”,
url:(本地?url.local:url.remote),
读者:{
root:“费用详细信息”,
totalProperty:“总计数”
},
simpleSortMode:true
},
分拣机:[{
属性:“患者姓名”,
方向:“描述”
}]
});
变量过滤器={
ftype:'过滤器',
//先前定义的编码和本地配置选项便于重用
encode:encode,//json对过滤器查询进行编码
local:local,//默认为false(远程筛选)
//过滤器最自然地放置在列定义中,但也可以
//加在这里。
过滤器:[{
键入:“字符串”,
数据索引:“患者姓名”
}]
};
//演示时使用工厂方法减少代码
//GridFilter插件可以配置为带或不带
//过滤器类型(可在柱模型上指定过滤器
var createColumns=函数(完成、开始){
变量列=[
{
menuDisabled:没错,
可排序:false,
xtype:'actioncolumn',
宽度:50,
项目:[{
图标:'../js/extjs_4_2/examples/shared/icons/fam/user_profile.png',//在图标配置中使用URL
工具提示:“患者档案”,
渲染器:renderTopic,
处理程序:函数(网格、行索引、colIndex){
var rec=store.getAt(行索引);
//警报(“票据Id:+rec.get('Bill_Id'));
//Ext.Msg.alert('Bill Info',rec.get('patient_name')+”,Bill Id:“+rec.get('Bill_Id')”);
window.location.href=“../newdash/profile.php?bill_id=“+rec.get('bill_id');
}
}, 
]
},
{
数据索引:“患者姓名”,
文本:“患者姓名”,
可排序:是的,
//只需指定filterable=true,而不是指定filter-config
//使用存储区字段的类型属性(如果类型属性不是
//在存储配置中显式指定它将是“自动”的
//GridFilter将假定为“StringFilter”
可过滤:真
//,筛选器:{type:'numeric'}
}, {
dataIndex:“推荐人\提供者”,
正文:“参考”,
可排序:正确
//弹性:1,
}, {
数据索引:“承认日期”,
文字:“录取日期”,
}, {
dataIndex:'已添加日期',
文本:“登录日期”
}, {
dataIndex:“计费日期”,
文本:'服务日期',
过滤器:对,
渲染器:Ext.util.Format.dateRenderer('m/d/Y')
}, {
数据索引:“dob”,
文本:“DOB”
//此列的筛选器在筛选器功能配置中定义
},{
数据索引:“loc_name”,
文本:“位置”,
可排序:正确
},{
数据索引:“医生姓名”,
文本:“医生(账单)”,
可排序:正确
},{
dataIndex:'内爆的\u诊断\u名称',
文本:“诊断”
},{
dataIndex:“内爆程序名称”,
文本:“程序”
},{
dataIndex:“内爆\u可选\u名称”,
文本:“选择模板”
},{
dataIndex:'内爆\u快速\u列表\u名称',
文本:“快速列表”
},{
数据索引:“医疗记录号”,
文本:“病历号”
},{
dataIndex:'消息',
文本:“文本或注释”
}
];
返回列。切片(开始| | 0,结束);
};
var pluginPanded=真;
var selModel=Ext.create('Ext.selection.CheckboxModel'{
栏目:[
{xtype:'checkcolumn',text:'Active',dataIndex:'bill_id'}
],
checkOnly:对,
模式:“多”,
enableKeyNav:false,
听众:{
选择更改:功能(sm、选择){
grid.down(“#removeButton”).setDisabled(selections.length==0);
}
}
});
var grid=Ext.create('Ext.grid.Panel'{
//宽度:1024,
身高:500,
标题:“收费信息”,
店:店,,
//disableSelection:正确,
loadMask:是的,
功能:[过滤器],
forceFit:对,
视图配置:{
是的,
启用文本选择:
var selected = selModel.getSelection();
var selected = selModel.getSelectionModel().getSelections();