Hybrid View

  1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    4
    Vote Rating
    0
    Mohammad90 is on a distinguished road

      0  

    Default Get CheckboxGridPanel selected rows values, v3.4.0 ?

    Get CheckboxGridPanel selected rows values, v3.4.0 ?


    I'm using Ext.net 1.2 == ExtJs 3.4.0

    I wanna add the selected values (Filter with Name, Lname) to an ext's textbox.
    I searched , and I could find the below codes, but now I don't know how I can add the the values from var values in JavaScript to an ext's textbox.

    Code:
    <script type="text/javascript">
        function AddUser() {
            var values = GridPanel1.getRowsValues(
            {
                filterField: function (record, fieldName, value) {return fieldName == "Name" || fieldName == "Lname";}, 
                selectedOnly: true,
                currentPageOnly: false
            });
            ////this method should be complete
        }
    </script>
     
    <div style="width: 500px; margin: 0 auto;">
        <ext:Store ID="Store1" runat="server" OnRefreshData="Store1_RefreshData">
            <Reader>
                <ext:JsonReader IDProperty="ID">
                    <Fields>
                        <ext:RecordField Name="ID" Type="Int" />
                        <ext:RecordField Name="RowNumber" Type="Int" />
                        <ext:RecordField Name="Name" />
                        <ext:RecordField Name="Lname" />
                        <ext:RecordField Name="EnterprisePosition" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
        </ext:Store>
        <br />
        <ext:GridPanel ID="GridPanel1" runat="server" StoreID="Store1" StripeRows="true"
            Title="Result" Collapsible="true" StyleSpec="width:95%; margin:0 auto;"
            Height="350" Collapsed="true">
            <ColumnModel ID="ColumnModel1" runat="server">
                <Columns>
                    <ext:Column ColumnID="RowNumber" Header="Row" Width="50" Resizable="false" MenuDisabled="true"
                        Fixed="true" DataIndex="RowNumber" />
                    <ext:Column ColumnID="Name" Header="Name" Width="100" DataIndex="Name" />
                    <ext:Column Header="Last Name" Width="150" DataIndex="Lname" />
                    <ext:Column Header="Position" Width="160" DataIndex="EnterprisePosition" />
                </Columns>
            </ColumnModel>
            <BottomBar>
                <ext:PagingToolbar ID="PagingToolBar1" runat="server" PageSize="10" StoreID="Store1"
                    DisplayInfo="false" />
            </BottomBar>
            <SelectionModel>
                <ext:CheckboxSelectionModel ID="CheckboxSelectionModel1" runat="server">
                    <Listeners>
                        <RowSelect Fn="AddUser" /><!-- ******** -->
                    </Listeners>
                </ext:CheckboxSelectionModel>
            </SelectionModel>
        </ext:GridPanel>
    </div>
    Could you please guide me ? Thanks

  2. #2
    Sencha User poojagarg89's Avatar
    Join Date
    Sep 2011
    Location
    Ahmedabad,India
    Posts
    213
    Vote Rating
    0
    poojagarg89 is on a distinguished road

      0  

    Default how to get values from Grid rows

    how to get values from Grid rows


    well....I dont know abt extjs 3.4 version
    but m using extjs4.0 and at first I got the same problem..........but now here is the solution
    try it in ur code

    put this particular code : where u want to call the form component
    for example:
    I want this value when I check the row and click on EDIT button:
    So this code has to cum inside the


    Code:
    buttons:[{
    text: 'EDIT',
    handler: function{
    var sm = Ext.getCmp('grid_ID').getSelectionModel();
     var rec=sm.getLastSelected();
    // for name and last name get the values from grid Selection 
    first_name = rec.get("first_name");
    last_name = rec.get("last_name");
    }
    }]
    through this u get the value of NAME n LNAME

    now put value: first_name and value: last_name where u have given :

    Code:
    xtype: 'textfield', 
    id: 'first_name',
     name: 'first_name', 
    fieldlabel: 'First Name', 
    value : first_name
    n same for last name:
    Code:
    xtype: 'textfield', 
    id: 'last_name',
     name: 'last_name', 
    fieldlabel: 'Last Name', 
    value : last_name
    Last edited by poojagarg89; 31 Oct 2011 at 4:43 AM. Reason: forgot something to write

  3. #3
    Sencha User
    Join Date
    Oct 2011
    Posts
    4
    Vote Rating
    0
    Mohammad90 is on a distinguished road

      0  

    Question I wanna all selected rows

    I wanna all selected rows


    Thanks for your reply.

    You wrote in your code :
    PHP Code:
    var rec=sm.getLastSelected(); 
    That give us only the last selected row details, whereas I wanna get all selected rows' values !!!

    How can I get all selected rows' values ?

  4. #4
    Sencha User poojagarg89's Avatar
    Join Date
    Sep 2011
    Location
    Ahmedabad,India
    Posts
    213
    Vote Rating
    0
    poojagarg89 is on a distinguished road

      0  

    Default


    hey this thing m also searching even I have posted a new thread for getting all selected rows of a grid
    but the code I was trying to execute may work with u as of ur working on extjs 3.x version
    Code:
    var count=Ext.getCmp('grid_id').getSelectionModel().getCount();
     var lst=Ext.getCmp('grid_id').getSelectionModel().getSelections();
    this will give u the selected rows of the grid by getSelections() method and the count of rows by getCount() method


    this code is not working for me as m using extjs 4.0 version
    hopefully it will work for u try this.............!
    Last edited by poojagarg89; 31 Oct 2011 at 5:23 AM. Reason: forgot something to write

  5. #5
    Sencha User
    Join Date
    Oct 2011
    Posts
    4
    Vote Rating
    0
    Mohammad90 is on a distinguished road

      0  

    Thumbs up Solved

    Solved


    Thanks, My problem was solved.
    The final code is following :

    Code:
    <script type="text/javascript">
        function AddUser() {
            Ext.getCmp('TextFieldReceivers').setValue("");
            var count = Ext.getCmp('GridPanel1').getSelectionModel().getCount();
            var lst = Ext.getCmp('GridPanel1').getSelectionModel().getSelections();
            var textfiled = Ext.getCmp('TextFieldReceivers');
            for (var i = 0; i < count; i++) {
                textfiled.setValue(textfiled.value + lst[i].data.Name + " " + lst[i].data.Lname + ",");
            }
        }
    </script>
    
    <div style="text-align: center; padding: 3px;">
        <span style="font-weight: bold; font-family: Arial, Helvetica, sans-serif; font-size: 18px;">
            جستجو کاربران </span>
        <br />
        <div style="width: 500px; margin: 0 auto;">
            <ext:Store ID="Store1" runat="server" OnRefreshData="Store1_RefreshData">
                <Reader>
                    <ext:JsonReader IDProperty="ID">
                        <Fields>
                            <ext:RecordField Name="ID" Type="Int" />
                            <ext:RecordField Name="RowNumber" Type="Int" />
                            <ext:RecordField Name="Name" />
                            <ext:RecordField Name="Lname" />
                            <ext:RecordField Name="EnterprisePosition" />
                        </Fields>
                    </ext:JsonReader>
                </Reader>
            </ext:Store>
            <br />
            <ext:GridPanel ID="GridPanel1" runat="server" StoreID="Store1" StripeRows="true"
                Title="نتیجه جستجو" Collapsible="true" StyleSpec="width:95%; margin:0 auto;"
                Height="350" Collapsed="true">
                <ColumnModel ID="ColumnModel1" runat="server">
                    <Columns>
                        <ext:Column ColumnID="ID" DataIndex="ID" Hidden="true" />
                        <ext:Column ColumnID="RowNumber" Header="ردیف" Width="50" Resizable="false" MenuDisabled="true"
                            Fixed="true" DataIndex="RowNumber" />
                        <ext:Column ColumnID="Name" Header="نام" Width="100" DataIndex="Name" />
                        <ext:Column Header="نام خانوادگی" Width="130" DataIndex="Lname" />
                        <ext:Column Header="جایگاه سازمانی" Width="140" DataIndex="EnterprisePosition" />
                    </Columns>
                </ColumnModel>
                <BottomBar>
                    <ext:PagingToolbar ID="PagingToolBar1" runat="server" PageSize="10" StoreID="Store1"
                        DisplayInfo="false" />
                </BottomBar>
                <SelectionModel>
                    <ext:CheckboxSelectionModel ID="CheckboxSelectionModel1" runat="server">
                        <Listeners>
                            <RowSelect Fn="AddUser"></RowSelect>
                            <RowDeselect Fn="AddUser"></RowDeselect>
                        </Listeners>
                    </ext:CheckboxSelectionModel>
                </SelectionModel>
            </ext:GridPanel>
        </div>

  6. #6
    Sencha User poojagarg89's Avatar
    Join Date
    Sep 2011
    Location
    Ahmedabad,India
    Posts
    213
    Vote Rating
    0
    poojagarg89 is on a distinguished road

      0  

    Default


    mention not

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi