Checkbox editor in boolean columns

  1. #1

    Checkbox editor in boolean columns

    Hello,

    I have a grid with four boolean columns that show checkboxes as editors. I would like checkboxes act llike radiobuttons for all four columns in the same row, that is, when any one is checked, others get unchecked.

    I'm stuck at the point of unchecking the other checkboxes during editing (meanwhile editors are visible) from client-side (using a listener funcion) or from server-side (using an ajax event).

    Any help will be greatly appreciated.
    Thank you
    Regards
    Alex
  2. #2
    Well, I solved this way using client-side

    Javascript:
                var clickCBFuncAsoc = function(chbox, val){
                    if (chbox == #{chkOrigen}) {
                        if (val == true) {
                            #{chkPara}.setValue(false);
                            #{chkCopia}.setValue(false);
                            #{chkVistoBueno}.setValue(false);
                        }
                    }
                    else if (chbox == #{chkPara}) {
                        if (val == true) {
                            #{chkOrigen}.setValue(false);
                            #{chkCopia}.setValue(false);
                            #{chkVistoBueno}.setValue(false);
                        }
                    }
                    ...
                }
    Grid:
                            <ext:BooleanColumn Header="De" DataIndex="es_origen" Width="70" Sortable="true" Groupable="true" TrueText="S?" FalseText="No"
                                Align="Center">
                                <Editor>
                                    <ext:Checkbox ID="chkOrigen" runat="server">
                                        <Listeners>
                                            <Check Fn="clickCBFuncAsoc" />
                                        </Listeners>
                                    </ext:Checkbox>
                                </Editor>
                            </ext:BooleanColumn>
                            <ext:BooleanColumn Header="Para" DataIndex="es_para" Width="70" Sortable="true" Groupable="true" TrueText="S?" FalseText="No"
                                Align="Center">
                                <Editor>
                                    <ext:Checkbox ID="chkPara" runat="server">
                                        <Listeners>
                                            <Check Fn="clickCBFuncAsoc" />
                                        </Listeners>
                                    </ext:Checkbox>
                                </Editor>
                            </ext:BooleanColumn>
                            <ext:BooleanColumn Header="Copia" DataIndex="es_copia" Width="70" Sortable="true" Groupable="true" TrueText="S?" FalseText="No"
                                Align="Center">
                                <Editor>
                                    <ext:Checkbox ID="chkCopia" runat="server">
                                        <Listeners>
                                            <Check Fn="clickCBFuncAsoc" />
                                        </Listeners>
                                    </ext:Checkbox>
                                </Editor>
                            </ext:BooleanColumn>
                            <ext:BooleanColumn Header="Visto Bueno" DataIndex="da_vistobueno" Width="70" Sortable="true" Groupable="true" TrueText="S?" FalseText="No"
                                Align="Center">
                                <Editor>
                                    <ext:Checkbox ID="chkVistoBueno" runat="server">
                                        <Listeners>
                                            <Check Fn="clickCBFuncAsoc" />
                                        </Listeners>
                                    </ext:Checkbox>
                                </Editor>
                            </ext:BooleanColumn>
    The code works fine, though I would like to prevent recursive calling to clickCBFuncAsoc function.
    How could I remove the listener, call setValue() and set the listener again from inside the function?

    Thank you
    Regards
    Alex
  3. #3
    Solved. Found methods removeListener() and addListener(). I should had checked Sencha ExtJS help before posting here.

Similar Threads

  1. Replies: 1
    Last Post: Aug 02, 2013, 7:16 PM
  2. [CLOSED] GridPanel + FormPanel insert record with boolean columns
    By John_Writers in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: May 22, 2013, 10:05 AM
  3. Replies: 0
    Last Post: Aug 23, 2012, 11:55 PM
  4. Replies: 3
    Last Post: Feb 09, 2011, 3:17 PM
  5. [CLOSED] Boolean value as Checkbox in a GridPanel
    By fondant in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: May 29, 2009, 11:34 AM

Tags for this Thread

Posting Permissions