PDA

View Full Version : help pls....



rex0098
7 Apr 2010, 10:59 PM
var checkBoxSelMod = new Ext.grid.CheckboxSelectionModel({
checkOnly:true,
listeners:
{
'rowselect':function(selectionModel,record)
{
var selectedRows = selectionModel.getSelections();
var count=0;
if( selectedRows.length > 0){

var recordsToSend = [];
Ext.each(selectedRows, function(record) {
recordsToSend.push(record.data);
});

var recordsToSend2 = Ext.encode(recordsToSend);

Ext.MessageBox.alert ('Message',' '+recordsToSend2+' ');
}
},
'rowdeselect':function(selectionModel,record)
{
var selectedRows = selectionModel.getSelections();
var count=0;
if( selectedRows.length > 0){

for( var i = 0; i < selectedRows.length; i++) {
count++;

}

Ext.MessageBox.alert ('Message','Num rows selected'+i+'.');
}
},
}
});

var store = new Ext.data.JsonStore({
url: 'get_pull_out.php',
baseParams:{pull:Ext.getCmp('pullout_date').getValue().format("Y-m-d")},
root: 'results',
autoLoad:false,
fields: [
{name: 'Pawn_ticket_number'},
{name: 'Cust_first_name'},
{name: 'Cust_middle_name'},
{name: 'Cust_last_name'},
{name: 'Cust_address'},
{name: 'Cust_municipality'},
{name: 'Pawn_date',type:'date',dateFormat:'Y-m-d'},
{name: 'Pawn_maturity',type:'date',dateFormat:'Y-m-d'},
{name: 'Pawn_expiry',type:'date',dateFormat:'Y-m-d'},
{name: 'Appraised_val'},
{name: 'Pawn_principal'},
{name: 'encoder'}
]
});
store.load();

var grid = new Ext.grid.GridPanel({
store: store,
loadMask:true,
selModel : checkBoxSelMod,
frame:true,
columns: [
checkBoxSelMod,
{header: 'Ticket #', width: 50, dataIndex: 'Pawn_ticket_number'},
{header: 'Remarks', width: 50, dataIndex: 'Pawn_ticket_number',hidden:true},
{header: 'First Name', width: 80, dataIndex: 'Cust_first_name'},
{header: 'Middle Name', width: 70, dataIndex: 'Cust_middle_name'},
{header: 'Last Name', width: 80, dataIndex: 'Cust_last_name'},
{id:'address',header: 'Address', width: 75,dataIndex: 'Cust_address'},
{header: 'Municipality', width: 75, dataIndex: 'Cust_municipality'},
{header: 'Pawn Date', width: 75, dataIndex: 'Pawn_date',
renderer: function(date) { return date.format("M-d-Y"); }},
{header: 'Maturity', width: 75, dataIndex: 'Pawn_maturity',
renderer: function(date) { return date.format("M-d-Y"); }},
{header: 'Expiry', width: 75, dataIndex: 'Pawn_expiry',
renderer: function(date) { return date.format("M-d-Y"); }},
{header: 'App. Value', width: 75, dataIndex: 'Appraised_val'},
{header: 'Principal', width: 75, dataIndex: 'Pawn_principal'},
{header: 'Encoder', width: 75, dataIndex: 'encoder'}
],
bbar:[{
xtype:'tbseparator'
},
{
xtype: 'tbbutton',
text: 'Pull out'
},
{
xtype:'tbseparator'
},
{
xtype: 'tbbutton',
text: 'Reserve'
}],
stripeRows: true,
columnLines:true,
autoExpandColumn: 'address',
stateful: true,
});


help me pls.....this is my code so far...what i would like to do here is after the grid loads i can select one or more data i want from the list, after checking the checkbox the i would want the value of "remarks" column for that row to change its value from 'ACTIVE'(value from database) to 'PULLOUT'(new value after checking the checkbox) and then when i press the "Pull out" button the changes that has been made will be updated to the data base.....

is this possible???please help me figure this out....

thank you.....i need it to work badly....:(

8 Apr 2010, 9:09 AM
I'm guessing the reason you didn't get a response is because your title is pretty ambiguous.