HZGN.COM
welcome to my space
X
Search:  
Feng Shui | Graphic Design | Cosmetics | Causes and Organizations | Regulatory Compliance | Gadgets and Gizmos | Computer Forensics | Tools and Equipment | Related articles
Welcome to:hzgn.com
NAVIGATION - HOME
[SOLVED] : Select Multiple Records in Grid
Published by: admin 2009-01-07

  • Ext: Help [Archive] - Page 11 - Ext JS Forums::
    Grid & Record field names. Problem with DateField grideditor. Adding a <select> box to a form [Solved] Multiple column layouts in multiple tabs in FormPanel
    http://extjs.com/forum/archive/index.php/f-9-p-11.html
    HOME
    Hi,

    I have a grid and a checkbox. What i want is... The user can select multiple records and press a button, on click of that button those records should be processed in an ASPX page.

    In the image attached i have selected 2 records and on click of process button i want to pass those records to aspx page via ajax call.

    my JS code



    Ext.onReady(function(){
    var js = new Ext.data.JsonStore({
    url: 'ExtGetData.aspx',
    //baseParams:{task: "PendingClaims"},
    root: 'data',
    fields: [
    {name: 'Submitted', mapping: 'ReimbursementDate'} ,
    {name: 'Participant', mapping: 'Name'},
    {name: 'GroupAlias', mapping: 'groupalias'},
    {name: 'ClaimID', mapping: 'claimid'},
    {name: 'ExpenseAmount', mapping: 'ExpenseAmount'},
    {name: 'Source', mapping: 'Source'},
    {name: 'SourceStatus', mapping: 'SourceStatus'},
    {name: 'ReimbursementStatus', mapping: 'ReimbursementStatus'},
    {name: 'Flag', mapping: 'Flag'},
    {name: 'PlanBenefitID', mapping: 'PlanBenefitID'},
    {name: 'ExpenseStartDate', mapping: 'ExpenseStartDate', type: 'date', dateFormat: 'timestamp'},
    Ext 1.x: Help [Archive] - Page 2 - Ext JS Forums::
    Display a button in a cell. Detecting single/multiple select in grid Showing NO RECORD FOUND message for Feed Viewer-2 Exampl
    http://extjs.com/forum/archive/index.php/f-5-p-2.html
    HOME
    Ext: Feature Requests [Archive] - Page 3 - Ext JS Forums::
    Multiple active editors for the EditorGrid. PropertyRecord to have Type in the record [solved] json based tree declaration. Add to store without triggering
    http://extjs.com/forum/archive/index.php/f-4-p-3.html
    HOME
    {name: 'ExpenseEndDate', mapping: 'ExpenseEndDate', type: 'date', dateFormat: 'timestamp'},
    {name: 'ExpenseID', mapping: 'ExpenseID'},
    {name: 'DependentID', mapping: 'DependentId'},
    {name: 'stage', mapping: 'stage'},
    {name: 'recordSelect'}
    ]
    });


    js.on('load',function()
    {
    var ds = new Ext.data.Store({
    proxy: new Ext.ux.data.PagingMemoryProxy(js.reader.jsonData),
    reader: js.reader,
    remoteSort: true
    });

    var sm1 = new Ext.grid.CheckboxSelectionModel({singleSelect:fals e});

    var myGrid = new Ext.grid.GridPanel
    ({
    el:'pending-grid',
    store: ds,
    columns:
    [
    {header: 'Submitted', dataIndex: 'Submitted', sortable: true},
    {header: 'Participant', dataIndex: 'Participant', sortable: true},
    {header: 'GroupAlias', dataIndex: 'GroupAlias', sortable: true},
    {header: 'ClaimID', dataIndex: 'ClaimID', sortable: true},
    {header: 'Claim ($)', dataIndex: 'ExpenseAmount', sortable: true},
    sm1
    ],
    title: 'Employee Grid',
    width: 950,
    height: 400,
    loadMask: true,
    //sm: sm,
    sm: new Ext.grid.CheckboxSelectionModel({
    singleSelect:false,
    listeners: {
    rowselect: function(sm, row, rec) {
    alert(rec.data.Participant);
    }
    }
    }),
    stripeRows: true,
    viewConfig:
    Ext: Help [Archive] - Page 25 - Ext JS Forums::
    Using ids to select rows in checkboxselectionmodel. update record to store from formPanel [solved] word wrapping in grid? Highlight grid row. Complex Drag n
    http://extjs.com/forum/archive/index.php/f-9-p-25.html
    HOME
    Database Viewer Plus (Access,Excel,Oracle) - PalmGear.com: Download ::
    Use 5-way Nevigator control on Grid View and Record View. profile, you can select a single table or multiple tables using build query dialog.
    http://www.palmgear.com/index.cfm?fuseaction=software.showsoftware&prodid=52608
    HOME
    {
    forceFit:true,
    enableRowBody:false,
    showPreview:false
    },
    bbar: new Ext.PagingToolbar
    ({
    pageSize: 10,
    store: ds,
    displayInfo: true,
    displayMsg: 'Displaying Employees {0} - {1} of {2}',
    emptyMsg: "No claims to display"
    }),
    tbar: [

    {
    text: 'Process',
    tooltip: 'Click to Process selected row(s)',

    //function to call when user clicks on button
    handler: handleProcess,
    iconCls:'remove'
    }, '-', // next fields will be aligned to the right
    {
    text: 'Refresh',
    tooltip: 'Click to Refresh the table',
    //handler: refreshGrid,
    iconCls:'refresh'
    }
    ]


    });

    myGrid.render();


    ds.load({params:{start:0, limit:10}});
    }); // js.on
    //myGrid.loadMask.show();
    //ds.load.defer(100,store);

    function handleProcess(){
    //alert("handleProcess");
    //console.log('handleProcess');
    //Ext.Msg.alert('Alert','This is a test message box. ' + myGrid.store.Participant);

    // How to access selected records here??????????????????????????????
    }


    js.load();

    function determineAction(){}
    // pluggable renders
    function renderClaim(value, p, record){
    //return String.format(
    // '{0}{1} Forum',
    // value, record.data.forumtitle, record.id, record.data.forumid);*/
    // alert("render topic");
    return String.format('{0}',value);
    }
    function renderLast(value, p, r){
    //return String.format('{0}
    by {1}', value.dateFormat('M j, Y, g:i a'), r.data['lastposter']);
    alert("render Last");
    }


    });


  • Problem solved....


    tbar changed as below....


    tbar: [

    {
    text: 'Process',
    tooltip: 'Click to Process selected row(s)',

    //function to call when user clicks on button
    handler: function(){
    //var selectedKeys = myGrid.selModel.selections.keys;
    //var selectedRows = myGrid.selModel.selections.items;
    //var selectedRows = Ext.getCmp('myGrid').getSelectionModel().getSelect ed().data.ID;
    //var encoded_keys = Ext.encode(selectedKeys);
    //var store = myGrid.getStore();
    var records = myGrid.selModel.getSelections();
    var ids = ;
    //alert(records.data);
    for (var i = 0, len = records.length; i < len; i++) {
    ids[i] = records[i].get('ClaimID');
    //alert(ids[i]);
    }
    //var encoded_keys = selectedKeys ;
    //Ext.Msg.alert('Alert','This is a test message box. ' + selectedRows.Participant);
    Ext.Ajax.request(
    {
    waitMsg: 'Processing Claims...',
    //url where to send request
    url: 'SERVER_SIDE_SCRIPT_URL', //url to server side script
    params: { //these will be available via $_POST or $_REQUEST:
    task: "Pending", //pass task to do to the server script
    keys: ids//the unique id(s)
    //rows: selectedRows,
    //primaryKey: primaryKey
    //key: primaryKey//pass to server same 'id' that the reader used
    },
    /* you can also specify a callback (instead of or in addition to
    success/failure) for custom handling. If you have success/failure
    defined, those will fire before 'callback'. This callback will fire
    regardless of success or failure.*/
    callback: function (options, success, response) {
    if (success) { //success will be true if the request succeeded
    Ext.MessageBox.alert('OK',response.responseText);//you won't see this alert if the next one pops up fast
    var json = Ext.util.JSON.decode(response.responseText);
    Ext.MessageBox.alert('OK',json.count + ' record(s) Substantiated. ');
    //console.log(json);
    } else {
    Ext.MessageBox.alert('Sorry, please try again. [Q304]',response.responseText);
    }
    },
    /* */
    //the function to be called upon failure of the request (server script, 404, or 403 errors)
    failure:function(response,options){
    Ext.MessageBox.alert('Warning','Oops...');
    //ds.rejectChanges();//undo any changes
    },
    success:function(response,options){
    //Ext.MessageBox.alert('Success','Yeah...');
    ds.reload();//commit changes and remove the red triangle which indicates a 'dirty' field
    }
    } //end Ajax request config
    )
    },
    iconCls:'false'
    }, '-', // next fields will be aligned to the right
    {
    text: 'Refresh',
    tooltip: 'Click to Refresh the table',
    handler: function(){
    ds.reload();
    },
    iconCls:'refresh'
    }
    ]


  • Start off w/ reading the getSelections() method of the selection Model.

    Then, read the ajax entry on the community manual wiki.


  • Congratulations, my friend.
    Mark this thread title as solved to help other users.


  • Very useful, thanks!


  • what do you need help with? getting selections?


  • In the image attached i have selected 2 records and on click of process button i want to pass those records to aspx page via ajax call.

    In fact, what do you want to do with the selected data? Remove, edit or just pass these information data to do something in another step?


  • In fact, what do you want to do with the selected data? Remove, edit or just pass these information data to do something in another step?

    ya i need to pass the data to my aspx page so that i can process them there...

    i want to run some stored proc and will pass the selected records in that proc





  • Red Hat's Rough Recovery From CFO Exit
    Windows Live Finds a New, Pre-installed Home

    PRINT Add to favorites
    #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about [SOLVED] : Select Multiple Records in Grid , Please add it free.

    About us -Site map -Advertisement -Jion us -Contact usExchange linksSponsor us
    Copyright© 2008 hzgn.com All Rights Reserved
    Site made&Support support@hzgn.com    E-mail: web@hzgn.com