[pve-devel] help with ExtJS4

Seth Lauzon seth.lauzon at gmail.com
Wed Jun 29 17:12:16 CEST 2011


Howdy Dietmar,

Thanks for your assistance.  I am making progress in learning the code with your help.  Can you explain a little about how the PVE.Utils.API2Request function works and how the url attribute is used to execute the proper commands.  This is what I have so far for deleting the user and it is not functioning.

            {  
                text: 'Delete',
                handler: function() {
                    var sm = me.getSelectionModel();
                    var rec = sm.getSelection()[0];
                    if (!rec)
                        return;

                    var userid = rec.data.userid;

                    var msg = 'Are you sure you want to permanently delete the user: ' + userid;
                    Ext.Msg.confirm('Deletion Confirmation', msg, function(btn) {
                        if (btn !== 'yes')
                            return;
                        PVE.Utils.API2Request({
                          url: '/user/' + userid,
                          method: 'DELETE',
                          callback: function() {
                            me.setLoading(false);
                            reload();
                          },
                          failure: function (response, opts) {
                            Ext.Msg.alert('Error',response.htmlStatus);
                          },
                        });
                    });
                }
            }

I appreciate all your help.

Thanks,
Seth

On Jun 29, 2011, at 12:21 AM, Dietmar Maurer wrote:

> I just replaced getLastSelected() with getSelection()[0] everywhere - seems to be more correct:
> 
> 	    var rec = sm.getSelection()[0];
> 
> Note: ExtJS4 is quite new and I am still struggling with interface changes - but it gets more stable with each release.
> 
> - Dietmar Maurer
> 
> 
>> -----Original Message-----
>> From: Dietmar Maurer
>> Sent: Mittwoch, 29. Juni 2011 06:41
>> To: 'Seth Lauzon'; pve-devel at pve.proxmox.com
>> Subject: RE: [pve-devel] help with ExtJS4
>> 
>> Hi Seth,
>> 
>> just commited that code. You need to use something like:
>> 
>> 		    var sm = me.getSelectionModel();
>> 		    var rec = sm.getLastSelected();
>> 		    if (!rec)
>> 			return;
>> 
>> 		    var userid = rec.data.userid;
>> 
> 



More information about the pve-devel mailing list