[CLOSED] Checkbox in Gridview

  1. #1

    [CLOSED] Checkbox in Gridview

    Hi, everybody!
    This is my first post here!

    I'm having some problems to implement a checkbox inside a gridview.

    My scenario is this:

    I have a grid, inside this grid I have some informations (brief description) of an event.
    I want to enable people select wich event they want (one or more than one).

    For this, I constructed an Grid with RowExpander.
    To select each event, I tried it in tree ways:

    1st: I added the checkbox selection model <ext:CheckboxSelectionModel>
    But, in this case, its add an "master" checkbox to select all rows, and I dont want it.
    Question: can I disable this "check all" checkbox?
    Question: How I can add database values (record_id field) to this checkbox?
    Example: http://www.fsba.edu.br/semanaacademi...ricao/ext.aspx

    2nd: I removed the checkboxSelectionModel and added <ext:RowSelectionModel>
    In this case, i added an checkboxcolum in my gridview. But all checkbox came checked and te user can't uncheck or check it (cant change state).
    Question: How can I enable user check/uncheck checkbox?
    Question: How I can add database values (record_id field) to this checkbox?
    Example: http://www.fsba.edu.br/semanaacademi...icao/ext2.aspx

    3rd: Still in <ext:RowSelectionModel> and removed the checkboxcolum
    In this way, i tryed to put an checkbox inside a expander, like this:


    <Plugins>
    <ext:RowExpander>
    <Template ID="Template1" runat="server">
    <div style="padding-left:40px">
    <p>Ementa: {ementa}</p>
    <p>Local: {local}</p>
    <p>Das{hora_inicio} às {hora_fim}</p>



    <ext:Checkbox runat="server" />




    </Template>
    </ext:RowExpander>

    But, when I run the page: Parser Error Message: The 'Text' property of 'Template' does not allow child objects.


    Any ideas? Can someone help-me?

    Thanks!!
  2. #2

    RE: [CLOSED] Checkbox in Gridview

    Hi caiomarques,

    Thanks for your post.

    1.* Question: can I disable this "check all" checkbox?
    **** I have added HideCheckAll property to v0.7.0 For now you can use next technic

    *** //add this style to your page
    *** <style type="text/css">
    ******** .x-grid3-hd-checker{background: transparent !important;}
    *** </style>
    
    ** //and set next Header for CheckBoxSelectionModel
    ** Header="&amp;nbsp;"
    2. Question: How can I enable user check/uncheck checkbox?
    *** Yes, the editing functionality was missing in CheckColumn. It added in v0.7.0 (just set Editable property of CheckColumn to true)

    3. The Template can't contains any server-side controls (at least now). You can play with template adding html markup (for excample, <input type='text'> and etc)

    4. How I can add database*values (record_id field)*to this checkbox?
    *** Can you clarify this? You can set ReaderID in Reader and this field will be associated with record. Also the CheckBoxSelectionModel (and also the RowSelectionModel) contains information about selected rows (https://examples1.ext.net/#/GridPane...box_Selection/).

  3. #3

    RE: [CLOSED] Checkbox in Gridview

    Vladimir, thank u so much for your help!

    About 4. How I can add database values (record_id field) to this checkbox?

    Claryfing...

    In my database, i have the record id. My sql statatement is like this

    Select id_curso,nome, tipo_curso,data,hora_inicio,hora_fim,local,ementa from my_table

    I want to atach this value[id_curso] (from database) to a line or checkbox in the


    <ext:CheckboxSelectionModel>



    Can I do this?

    
    
    
    <ext:Store ID="Store1" runat="server">
    
    
    <Reader>
    
    
    <ext:JsonReader>
    
    
    <Fields>
    
    
    
    
    
    
    <ext:RecordField Name="id_curso" />
    
    <ext:RecordField Name="nome" />
    
    
    <ext:RecordField Name="tipo_curso"/>
    
    
    <ext:RecordField Name="data" Type="Date" />
    
    
    <ext:RecordField Name="hora_inicio" Type="Date"/>
    
    
    <ext:RecordField Name="hora_fim" Type="Date"/>
    
    
    <ext:RecordField Name="local"/>
    
    
    <ext:RecordField Name="ementa"/>
    
    
    
    
    
    </Fields>
    
    
    </ext:JsonReader>
    
    
    </Reader>
    
    
    </ext:Store>
    
    
    
    
    
    <ext:GridPanel ID="GridPanel1" runat="server" StoreID="Store1" Title="Semana Acadêmica" Frame="true" Height="600" TrackMouseOver="true" StripeRows="true">
  4. #4

    RE: [CLOSED] Checkbox in Gridview

    You can set id field in reader

    <ext:JsonReader ReaderID="id_curso" >
    Then on server side (on postback or AjaxEvent) you can check what rows selected
            CheckBoxSelectionModel sm = this.GridPanel1.SelectionModel.Primary as CheckBoxSelectionModel;
    
            foreach (SelectedRow row in sm.SelectedRows)
            {
                   // use  row.RecordID
            }
  5. #5

    RE: [CLOSED] Checkbox in Gridview

    Thanks, Vladimir!


Similar Threads

  1. Replies: 2
    Last Post: Nov 04, 2011, 6:06 PM
  2. CheckBox Update Problem in Gridview.
    By Ganesh3.shirsath in forum 1.x Help
    Replies: 0
    Last Post: Jan 07, 2011, 9:03 AM
  3. Gridview - Rows with Checkbox
    By FilipeCosta in forum 1.x Help
    Replies: 8
    Last Post: Nov 17, 2010, 10:30 AM
  4. Replies: 4
    Last Post: Oct 06, 2010, 9:08 AM
  5. [CLOSED] Default selected checkbox in gridview
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Aug 06, 2010, 10:57 AM

Posting Permissions