2

I have view that displays a list of records. When you click a record, a panel should pop up giving us a field "Status". I have accomplished it as below

'listeners : {
                        scope : this,<br>
                        itemtap : function(dataview, index, el, record, e){<br>

                            var formPanel = Ext.create('Ext.form.Panel',{
                                alias: "widget.formpanelview",
                                 modal : true,
                                hideOnMaskTap : true,
                                centered : true,
                                scrollable : 'vertical',
                                layout: { type: 'vbox', align: 'stretch' },
                                items:[
                                {xtype: 'spacer'},
                                {
                                    xtype: 'selectfield',
                                    name: 'Status__c',
                                    label: 'Status',
                                    options: [ 
                                         //some options 
                                     ]
                                     },
                                     {
                                        xtype: 'button',
                                        //width : 100,
                                        text: 'Save',
                                        handler: function(){
                                            console.log('Inside Save');
                                            var InvStore = Ext.getStore('Investors');
                                            InvStore.sync();
                                            console.log('Completed Sync');
                                            formPanel.hide();
                                        }
                                     },
                                     {xtype: 'spacer'},
                                     {
                                        xtype: 'button',
                                        text: 'Cancel',
                                        itemId: 'cancel',
                                        //width : 100,
                                        handler: function(){
                                            formPanel.hide();
                                        }
                                     }]
                            });
                            formPanel.setRecord(record);
                            Ext.Viewport.add(formPanel).show();
                        }'


Cancel button works fine and hides the panel, save button executes fully and hides panel but data is not storing. I have given "Update" in my model for sync to execute.

proxy: {<br>
            type: 'direct',<br>
            api: {<br>
                read: PocketCRMAccountController.Query,<br>
                update: PocketCRMAccountController.Edit<br>
            }


What might be the cause for store not to execute?

I think I zero'd in on the problem. When I put a "Status" debug on the save method, It is showing the old value. It is not showing the changed value. I dont know why it is not showing the changed one. If it changes, Sync would work it seems. any help?

6
  • PLEASE try to use relevant tags only. Picking a collection of tags that are not specifically related to your question, may make it appear not related to salesforce and closed as off topic. Elaborating a bit more on the context and what you're trying to achieve/build overall may also help. Jan 8, 2014 at 20:46
  • Can you show us your apex code? Jan 9, 2014 at 8:58
  • @user320. Want me to show the controller code?
    – Lokesh Pad
    Jan 9, 2014 at 10:24
  • Yes please, all of it :-) Jan 9, 2014 at 10:43
  • 1
    instead of just Direct proxy, might be worth a shot using the Visualforce Remoting proxy for Sencha Touch: github.com/financialforcedev/fflib-touch-common/blob/master/src/… - will simplify your components and controller code Jan 9, 2014 at 11:01

2 Answers 2

1

You need to the call the InvStore.load() after you do the syncing using InvStore.sync()

Also, are you using a writer to write to your store? Your proxy code looks incomplete. Force.com MVP Don Robins published a detailed tutorial which explains the concepts of proxy and store in detail. You can read it here.

4
  • I have a writer to my store. I didn't give it above. Actually my sync is good but as I didn't change the value, sync saw no change in value. Anyway, thank you for providing your view.
    – Lokesh Pad
    Jan 9, 2014 at 7:49
  • Okay, in future, please provide the complete code snippet for reference so others can understand your issue fully. I am hoping your problem is resolved. If so, please close this thread. Jan 9, 2014 at 7:58
  • Can you tell how could add a header to my dataview? I tried using a toolbar but as I have 5 columns, title is in center and Isn't helping. Any suggestions? @user320? Gaurav?
    – Lokesh Pad
    Jan 9, 2014 at 10:23
  • 1
    I would request you raise another question for that with proper citing of your UI code. It won't be useful for anyone else to discuss unrelated questions on this thread. Jan 9, 2014 at 11:14
1

The main problem was that , I didn't update the value of status when "store.sync" was executed. It was a silly mistake but it taught me something. Hope this mistake helps others not to do that. Please debug your values before you update any store. I am closing this thread. Thank you for everyone who tried to help.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .