[CLOSED] Binding problem with <ext:Store>

  1. #1

    [CLOSED] Binding problem with <ext:Store>

    In following DataView, I try to bind StoreActivities with code as follows,

    using (CandidateEntities context = new CandidateEntities())
                    {
                        Guid candidateGuid = new Guid(candidateId);
                        var results = from p in context.Activities
                                      where p.CandidateId == candidateGuid
                                      select p.Description;
    
                        if (results.ToList().Any())
                        {
                            StoreActivities.DataSource = results.ToList();
                            StoreActivities.DataBind();
                        }
                    }
    The results.ToList() contain some objects of type string. Which is fine, I have checked in debugger. After above DataBind(), listener abc(str) is called, which contains no data. What would be the problem?


    <ext:Panel ID="Panel5" runat="server" Region="Center" Title="Activities">
                        <Items>
                            <ext:DataView runat="server" Padding="6" DisableSelection="true" Width="450">
                                <Store>
                                    <ext:Store ID="StoreActivities" runat="server">
                                        <Model>
                                            <ext:Model ID="ModelActivity" runat="server">
                                                <Fields>
                                                    <ext:ModelField Name="Description"/>
                                                </Fields>
                                            </ext:Model>
                                        </Model>
                                        <Listeners>
                                            <Load Handler="abc(this);"></Load>
                                        </Listeners>
                                    </ext:Store>
                                </Store>
                                <ItemTpl>
                                    <Html>
                                        <tpl if="!editing">
                                            <div style="position:relative; border: solid gray 1px; padding:6px; margin-bottom:6px;">
                                                <p>Description: {Description}</p>
                                                <div class="edit-button" style="position:absolute; right: 10px; bottom:10px;"></div>
                                            </div>
                                        </tpl>
    
                                        <tpl if="editing">
                                            <div style="position:relative; border: solid gray 1px; padding:6px; margin-bottom:6px;">
                                                <p>{TextField}</p>
                                                <div class="edit-button" style="position:absolute; right: 10px; bottom:35px;"></div>
                                                <div class="cancel-button" style="position:absolute; right: 10px; bottom:10px;"></div>
                                            </div>
                                        </tpl>
                                    </Html>
                                </ItemTpl>
                                <Plugins>
                                    <ext:ComponentView runat="server">
                                        <Items>
                                            <ext:ViewItem Selector="div.edit-button" Tag="editing">
                                                <Component>
                                                    <ext:Button 
                                                        runat="server" 
                                                        Icon="NoteEdit" 
                                                        Handler="var record = this.record, editing = record.get('editing'); record.set('editing', !editing); if (editing) {record.commit(true);} " 
                                                        />
                                                </Component>
                                            </ext:ViewItem>
    
                                            <ext:ViewItem Selector="div.cancel-button">
                                                <Component>
                                                    <ext:Button runat="server" Icon="Decline" Text="Cancel" Handler="this.record.reject();" />                                
                                                </Component>
                                            </ext:ViewItem>
    
                                            <ext:ViewItem Value="TextField" BoundField="Description">
                                                <Component>
                                                    <ext:TextField runat="server" FieldLabel="Description" />
                                                </Component>
                                            </ext:ViewItem>
                                        </Items>
                                        <Listeners>
                                            <BeforeComponentBind Handler="if(item.tag == 'editing') {component.text = record.data.editing ? 'Save' : 'Edit';}" />
                                        </Listeners>
                                    </ext:ComponentView>
                                </Plugins>
                            </ext:DataView>
                        </Items>
                    </ext:Panel>
    Last edited by Daniil; Feb 18, 2014 at 9:29 AM. Reason: Please use [CODE] tags, [CLOSED]
  2. #2
    Hi @aditya,

    Please wrap the code in [CODE] tags. Please do not create a new post. Just edit the existing one.
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi @aditya,

    Please wrap the code in [CODE] tags. Please do not create a new post. Just edit the existing one.
    In following DataView, I try to bind StoreActivities with code as follows,

    using (CandidateEntities context = new CandidateEntities())
    {
    Guid candidateGuid = new Guid(candidateId);
    var results = from p in context.Activities
    where p.CandidateId == candidateGuid
    select p.Description;
    
    if (results.ToList().Any())
    {
    StoreActivities.DataSource = results.ToList();
    StoreActivities.DataBind();
    }
    }
    The results.ToList() contain some objects of type string. Which is fine, I have checked in debugger. After above DataBind(), listener abc(str) is called, which contains no data. What would be the problem?


    <ext:Panel ID="Panel5" runat="server" Region="Center" Title="Activities">
    <Items>
    <ext:DataView runat="server" Padding="6" DisableSelection="true" Width="450">
    <Store>
    <ext:Store ID="StoreActivities" runat="server">
    <Model>
    <ext:Model ID="ModelActivity" runat="server">
    <Fields>
    <ext:ModelField Name="Description"/>
    </Fields>
    </ext:Model>
    </Model>
    <Listeners>
    <Load Handler="abc(this);"></Load>
    </Listeners>
    </ext:Store>
    </Store>
    <ItemTpl>
    <Html>
    <tpl if="!editing">
    <div style="position:relative; border: solid gray 1px; padding:6px; margin-bottom:6px;">
    <p>Description: {Description}</p>
    <div class="edit-button" style="position:absolute; right: 10px; bottom:10px;"></div>
    </div>
    </tpl>
    
    <tpl if="editing">
    <div style="position:relative; border: solid gray 1px; padding:6px; margin-bottom:6px;">
    <p>{TextField}</p>
    <div class="edit-button" style="position:absolute; right: 10px; bottom:35px;"></div>
    <div class="cancel-button" style="position:absolute; right: 10px; bottom:10px;"></div>
    </div>
    </tpl>
    </Html>
    </ItemTpl>
    <Plugins>
    <ext:ComponentView runat="server">
    <Items>
    <ext:ViewItem Selector="div.edit-button" Tag="editing">
    <Component>
    <ext:Button
    runat="server"
    Icon="NoteEdit"
    Handler="var record = this.record, editing = record.get('editing'); record.set('editing', !editing); if (editing) {record.commit(true);} "
    />
    </Component>
    </ext:ViewItem>
    
    <ext:ViewItem Selector="div.cancel-button">
    <Component>
    <ext:Button runat="server" Icon="Decline" Text="Cancel" Handler="this.record.reject();" />
    </Component>
    </ext:ViewItem>
    
    <ext:ViewItem Value="TextField" BoundField="Description">
    <Component>
    <ext:TextField runat="server" FieldLabel="Description" />
    </Component>
    </ext:ViewItem>
    </Items>
    <Listeners>
    <BeforeComponentBind Handler="if(item.tag == 'editing') {component.text = record.data.editing ? 'Save' : 'Edit';}" />
    </Listeners>
    </ext:ComponentView>
    </Plugins>
    </ext:DataView>
    </Items>
    </ext:Panel>
  4. #4
    Could you, please, re-read my post?
    Quote Originally Posted by Daniil View Post
    Please wrap the code in [CODE] tags. Please do not create a new post. Just edit the existing one.
  5. #5

    Please close this.

    please close this.
    Last edited by aditya; Feb 19, 2014 at 4:51 AM.

Similar Threads

  1. Problem in store binding
    By softlabsgroup.support in forum 1.x Help
    Replies: 0
    Last Post: Jun 09, 2012, 7:15 AM
  2. Column is not binding to JSON store
    By principal_X in forum 1.x Help
    Replies: 3
    Last Post: Jan 16, 2012, 3:41 AM
  3. Store Data is not binding
    By Rahul in forum 1.x Help
    Replies: 7
    Last Post: Jul 27, 2011, 10:31 AM
  4. Binding json to store
    By pintun in forum 1.x Help
    Replies: 2
    Last Post: Apr 22, 2010, 11:16 AM
  5. [CLOSED] Store is not binding
    By majestic in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Apr 01, 2010, 12:47 PM

Tags for this Thread

Posting Permissions