Skip to content

JavaScript Extjs combo box selection to call method in mvc

Andrew Mystery

Asked Nov 23, 2015, 11:23 AM EST1 answer
Share
LinkedInX

Here is my combo box I want to put 3 values in this combo box and have it so when a value is selected it calls a method in my controller class.

Could I get a example on how to call my method in a different class from a value selected in the combo box 

C#
{
            xtype: 'label',
            style: 'margin-right:5px;margin-left:3px',
            text: 'Format'
}, {
            id: 'FormatId',
            xtype: 'combo',
            width: 140,
            displayField: 'Text',
            valueField: 'Value',
            emptyText: 'Default',
            hiddenName: 'FormatId',
            forceSelection: true,
            triggerAction: 'all',
            mode: 'local',
//Controller class
[Authorize(Roles = RoleAdmin + "," + RoleBilling + "," + RoleBillingDocument)]
private ActionResult TripLogSpreadsheet(List<usp_TripLogResult> list, object[] filterStrs) 
        {
const int colRideDate = 0;
const int colJobNum = 1;
const int colMemberName = 2;
const int colAWS = 3;
const int colRNS = 4;
                {
ICell hCell = hRow.CreateCell(colWaitTime, CellType.NUMERIC);
                    hCell.CellStyle = template_row.GetCell(colWaitTime).CellStyle;
                    hCell.SetCellValue(record.WaitTime);
                }
                {
ICell hCell = hRow.CreateCell(colBilledAmount, CellType.STRING);
                    hCell.CellStyle = template_row.GetCell(colBilledAmount).CellStyle;
                    hCell.SetCellValue(String.Empty);
                }
                {
ICell hCell = hRow.CreateCell(colAttendantsQty, CellType.STRING);
                    hCell.CellStyle = template_row.GetCell(colAttendantsQty).CellStyle;
                    hCell.SetCellValue(!String.IsNullOrEmpty(record.AttendantsQty) ? record.AttendantsQty : String.Empty);                    
                }
                {
ICell hCell = hRow.CreateCell(colSignature, CellType.STRING);
                    hCell.CellStyle = template_row.GetCell(colSignature).CellStyle;
                    hCell.SetCellValue(String.Empty);
                }
            sheet.ForceFormulaRecalculation = true;
var memoryStream = new MemoryStream();
            wk.Write(memoryStream);
return File(memoryStream.ToArray(), "application/vnd.ms-excel", "trip_log.xls");
        }

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    I have created this Model and Store - i believe this will work with combo box Store:formatStyleSheet ?
    Ext.define('formatStyleSheetModel', {
    extend: 'Ext.data.Model',
    fields: [
    { name: 'value', type: 'int' },
    { name: 'spreadsheet', type: 'string' },
    Code
            { name: 'format', type: 'string' }
        ]
    });
    
    var formatStore = new Ext.data.Store({
    model: 'formatStyleSheetModel',
    data: [
    { value: 0, spreadsheet: 'Logisticare', format: 'Logisticare', defaultValue: true },
    { value: 1, spreadsheet: 'MTM', format: 'MTM' },
    Code
            { value: 2, spreadsheet: 'Access2Care', format: 'Access2Care'}
        ]
    });
    0