Skip to content

Commit

Permalink
AutoEditableGrid : button del now sends request
Browse files Browse the repository at this point in the history
  • Loading branch information
revolunet committed Mar 2, 2010
1 parent f5d113b commit 39f3c68
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ Django [Form][1] and [ModelForm][2] power for your [ExtJs][3] apps.

Convert your forms.Form and forms.ModelForm to extjs and handles the form submission like any django form.

Generate custom ExtJs dynamic grids from django models.
Generate custom ExtJs dynamic grids from django querysets. You can also set your grids as Editable.

Tested with ExtJs 3 and Django >= 1 Feedback needed : <julien@bouquillon.com>

There is a full working demo project based on my django-skeleton here : [ExtJs django-skeleton branch][8]
There is a full working demo project based on my django-skeleton here : [ExtJs django-skeleton branch][8] this is where you should start.

**Grid example :**

Expand Down
30 changes: 28 additions & 2 deletions static/js/Ext.ux.AutoEditableGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,35 @@ Ext.ux.AutoEditableGrid = Ext.extend(Ext.ux.AutoGrid, {
,iconCls:'icon-user_delete'
,scope:this
,handler:function() {
alert('del');
// alert('del');
var records = this.getSelectionModel().getSelections();
// todo messagebox confirm
dels = [];
Ext.each(records, function(item, index, all) {
dels.push(item.id);
},this);

// console.log(dels);
var sure = confirm("Sure to delete these "+ dels.length + " items ?");
if (dels.length > 0 ) {
Ext.Ajax.request({
url: this.store.proxy.url,
method :'POST',
callback : function(options, success, response) {
json = Ext.decode(response.responseText);
if (!success || !json.success) {
alert("Erreur : " + json.msg);
}
else{
// this.btn_save.stopBlink();
// this.btn_save.disable();
// this.getStore().commitChanges();
this.getStore().reload();
}
},
scope: this,
params: { delete: dels.join(',')}
});
}
}
});
this.btn_save = new Ext.Button({
Expand Down

0 comments on commit 39f3c68

Please sign in to comment.