5 Replies Latest reply on Aug 17, 2009 8:53 AM by Gregory Lafrance

    Set border and color for my Datagrid

    3adlouz

      Hello,

       

      I woud like to set the border and color of my datagrid. Id o the following but without reseult

       

      <mx:DataGrid
           xmlns:mx="http://www.adobe.com/2006/mxml"
           sortableColumns="false"
           variableRowHeight="true"
           selectable="true"
           height="85"
           borderStyle="solid"
           borderColor="red"

           >
        • 1. Re: Set border and color for my Datagrid
          Gregory Lafrance Level 6

          It should work, this code works:

           

          <?xml version="1.0"?>

          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

             <mx:DataGrid borderStyle="solid" borderColor="0xFF0000">

                <mx:ArrayCollection>

                   <mx:Object>

                      <mx:Artist>Pavement</mx:Artist>

                      <mx:Price>11.99</mx:Price>

                      <mx:Album>Slanted and Enchanted</mx:Album>

                   </mx:Object>

                   <mx:Object>

                      <mx:Artist>Pavement</mx:Artist>

                      <mx:Album>Brighten the Corners</mx:Album>

                      <mx:Price>11.99</mx:Price>

                   </mx:Object>

                </mx:ArrayCollection>

             </mx:DataGrid>

          </mx:Application>

           

          If this post answers your question or helps, please mark it as such.

          • 2. Re: Set border and color for my Datagrid
            3adlouz Level 1

            I really do not know why I have this bas behaviour . My entire code si the following:

             

            <?xml version="1.0" encoding="utf-8"?>
            <mx:DataGrid
                xmlns:mx="http://www.adobe.com/2006/mxml"
                sortableColumns="false"
                variableRowHeight="true"
                selectable="true">
               
                <mx:Script>
                    <![CDATA[
                       
                        private var _allExpand:Boolean = false;

             

                        public function get allExpand():Boolean
                        {
                            return _allExpand;
                        }

             

                        public function set allExpand(value:Boolean):void
                        {
                            _allExpand = value;
                            invalidateList();
                        }
                    ]]>
                </mx:Script>
               
                <mx:columns>
                    <mx:DataGridColumn
                        width="320"
                        headerText="Produit"
                        dataField="name"
                        headerRenderer="view.ProductHeaderRenderer"
                        itemRenderer="view.ProductItemRenderer"/>
                       
                    <mx:DataGridColumn
                        width="70"
                        headerText="Doc"
                        headerRenderer="view.DocHeaderRenderer"
                        itemRenderer="view.DocItemRenderer"/>
                </mx:columns>
            </mx:DataGrid>

            • 3. Re: Set border and color for my Datagrid
              Gregory Lafrance Level 6

              In this code you are not setting the border and color, but if you add the code setting them, and remove the renderers, what happens? Maybe that is the problem.

               

              If this post answers your question or helps, please mark it as such.

              • 4. Re: Set border and color for my Datagrid
                3adlouz Level 1

                Oooops sorry my code is:

                 

                 

                 

                <?xml version="1.0" encoding="utf-8"?>
                <mx:DataGrid
                    xmlns:mx="http://www.adobe.com/2006/mxml"
                    sortableColumns="false"
                    variableRowHeight="true"
                    selectable="true"

                    borderColor="red"
                    borderStyle="solid"
                >
                   
                    <mx:Script>
                        <![CDATA[
                           
                            private var _allExpand:Boolean = false;

                 

                            public function get allExpand():Boolean
                            {
                                return _allExpand;
                            }

                 

                            public function set allExpand(value:Boolean):void
                            {
                                _allExpand = value;
                                invalidateList();
                            }
                        ]]>
                    </mx:Script>
                   
                    <mx:columns>
                        <mx:DataGridColumn
                            width="320"
                            headerText="Produit"
                            dataField="name"
                            headerRenderer="view.ProductHeaderRenderer"
                            itemRenderer="view.ProductItemRenderer"/>
                           
                        <mx:DataGridColumn
                            width="70"
                            headerText="Doc"
                            headerRenderer="view.DocHeaderRenderer"
                            itemRenderer="view.DocItemRenderer"/>
                    </mx:columns>
                </mx:DataGrid>

                • 5. Re: Set border and color for my Datagrid
                  Gregory Lafrance Level 6

                  If I reduce it to this, it works, so I would examine your renderers to see if they are causing the problem.

                   

                  Perhaps you need to call super() in the constructor if they are ActionScript classes.

                   

                  If this post answers your question or helps, please mark it as such.