.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2020 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc



.. _wx.dataview.DataViewListModel:

==========================================================================================================================================
|phoenix_title|  **wx.dataview.DataViewListModel**
==========================================================================================================================================

Base class with abstract API for :ref:`wx.dataview.DataViewIndexListModel`  and :ref:`wx.dataview.DataViewVirtualListModel`.          









|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>DataViewListModel</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.dataview.DataViewListModel_inheritance.png" alt="Inheritance diagram of DataViewListModel" usemap="#dummy" class="inheritance"/></center>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.dataview.DataViewListModel.html" title="wx.dataview.DataViewListModel" alt="" coords="5,160,239,189"/> <area shape="rect" id="node2" href="wx.dataview.DataViewModel.html" title="wx.dataview.DataViewModel" alt="" coords="17,83,227,112"/> <area shape="rect" id="node3" href="wx.RefCounter.html" title="wx.RefCounter" alt="" coords="63,5,181,35"/> </map> 
   </p>
   </div>

|


|sub_classes| Known Subclasses
==============================

:ref:`wx.dataview.DataViewIndexListModel`, :ref:`wx.dataview.DataViewVirtualListModel`

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.dataview.DataViewListModel.Compare`                                   Compare method that sorts the items by their index.
:meth:`~wx.dataview.DataViewListModel.GetAttrByRow`                              Override this to indicate that the row has special font attributes.
:meth:`~wx.dataview.DataViewListModel.GetCount`                                  Returns the number of items (or rows) in the list.
:meth:`~wx.dataview.DataViewListModel.GetRow`                                    Returns the position of given `item`.
:meth:`~wx.dataview.DataViewListModel.GetValueByRow`                             Override this to allow getting values from the model.
:meth:`~wx.dataview.DataViewListModel.IsEnabledByRow`                            Override this if you want to disable specific items.
:meth:`~wx.dataview.DataViewListModel.SetValueByRow`                             Called in order to set a value in the model.
================================================================================ ================================================================================


|


|property_summary| Properties Summary
=====================================

================================================================================ ================================================================================
:attr:`~wx.dataview.DataViewListModel.Count`                                     See :meth:`~wx.dataview.DataViewListModel.GetCount`
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: wx.dataview.DataViewListModel(DataViewModel)

   Base class with abstract API for DataViewIndexListModel and
   DataViewVirtualListModel.



   .. method:: Compare(self, item1, item2, column, ascending)

      Compare method that sorts the items by their index.                  


      :param `item1`: 
      :type `item1`: wx.dataview.DataViewItem
      :param `item2`: 
      :type `item2`: wx.dataview.DataViewItem
      :param `column`: 
      :type `column`: int
      :param `ascending`: 
      :type `ascending`: bool




      :rtype: `int`








   .. method:: GetAttrByRow(self, row, col, attr)

      Override this to indicate that the row has special font attributes.                  

      This only affects the DataViewTextRendererText() renderer. 

      The base class version always simply returns ``False``. 




      :param `row`: The row for which the attribute is requested.   
      :type `row`: int
      :param `col`: The column for which the attribute is requested.   
      :type `col`: int
      :param `attr`: The attribute to be filled in if the function returns ``True``.   
      :type `attr`: wx.dataview.DataViewItemAttr










      :rtype: `bool`



                  



      :returns: 

         ``True`` if this item has an attribute or ``False`` otherwise.   







      .. seealso:: :ref:`wx.dataview.DataViewItemAttr`.  








   .. method:: GetCount(self)

      Returns the number of items (or rows) in the list.                  

      :rtype: `int`








   .. method:: GetRow(self, item)

      Returns the position of given `item`.                  


      :param `item`: 
      :type `item`: wx.dataview.DataViewItem




      :rtype: `int`








   .. method:: GetValueByRow(self, row, col)

      Override this to allow getting values from the model.                  


      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int




      :rtype: `variant`








   .. method:: IsEnabledByRow(self, row, col)

      Override this if you want to disable specific items.                  

      The base class version always returns ``True``, thus making all items enabled by default. 




      :param `row`: The row of the item whose enabled status is requested.   
      :type `row`: int
      :param `col`: The column of the item whose enabled status is requested.   
      :type `col`: int








      :rtype: `bool`



                  



      :returns: 

         ``True`` if the item at this row and column should be enabled, ``False`` otherwise.  







      .. versionadded:: 2.9.2 
     







      .. note:: 

         See :meth:`wx.dataview.DataViewModel.IsEnabled`   for the current status of support for disabling the items under different platforms.  








   .. method:: SetValueByRow(self, variant, row, col)

      Called in order to set a value in the model.                  


      :param `variant`: 
      :type `variant`: DVCVariant
      :param `row`: 
      :type `row`: int
      :param `col`: 
      :type `col`: int




      :rtype: `bool`








   .. attribute:: Count

      See :meth:`~wx.dataview.DataViewListModel.GetCount`

