1. #1
    Ext User
    Join Date
    Mar 2007
    Posts
    4
    Vote Rating
    0
    lsmith is on a distinguished road

      0  

    Default grid sort marks all rows by the first column

    grid sort marks all rows by the first column


    I have a really wierd issue. You can see the code below. Essentially I have two different possible values (actually images) in the first column. When I have no row selected I can sort and nothing gets automatically selected. But if I now select a row and now click on any of the sort buttons, it automatically selects all rows that have the same value/image in the first column.

    Code:
    <style>
    
    .message_list{
      float:right;
      width:600px;
      border:1px solid #c3daf9;
      border-top:1px solid #DCEAFB;
      border-left:1px solid #DCEAFB;
      font-size:10px;
      padding:8px;
    }
    
    </style>
    
    <script type="text/javascript" language="javascript">
    // <![CDATA[
    
    var message_list = {
        init : function(){
          var myData = [
            ['[img]read.jpg[/img]','Aril29','Lorem ...','12.11.2006','MMS','100kb'],
            ['[img]unread.jpg[/img]','Aril29','Lorem ...','12.11.2006','MMS','300kb'],
            ['[img]read.jpg[/img]','Sandy-from-the-sun','Lorem ...','12.11.2006','MMS','300kb'],
            ['[img]unread.jpg[/img]','Aril29','Lorem ...','12.11.2006','MMS','220kb'],
            ['[img]unread.jpg[/img]','Aril29','Lorem ...','12.11.2006','MMS','230kb'],
            ['[img]read.jpg[/img]','ZONE','Lorem ...','12.11.2006','SMS',''],
            ['[img]read.jpg[/img]','Aril29','Lorem ...','12.11.2006','MMS','300kb'],
            ['[img]read.jpg[/img]','Sandy-from-the-sun','Lorem ...','12.11.2006','MMS','300kb'],
            ['[img]unread.jpg[/img]','Sandy-from-the-sun','Lorem ...','12.11.2006','SMS',''],
            ['[img]read.jpg[/img]','Aril29','Lorem ...','12.11.2006','SMS',''],
            ['[img]unread.jpg[/img]','ZONE','Lorem ...','12.11.2006','MMS','80kb'],
            ['[img]unread.jpg[/img]','Aril29','Lorem ...','12.11.2006','SMS',''],
            ['[img]read.jpg[/img]','Aril29','Lorem ...','12.11.2006','MMS','150kb'],
            ['[img]read.jpg[/img]','Aril29','Lorem ...','12.11.2006','MMS','120kb'],
          ];
          var dataModel = new YAHOO.ext.grid.DefaultDataModel(myData);
    
          // the DefaultColumnModel expects this blob to define columns. It can be extended to provide 
          // custom or reusable ColumnModels
          var colModel = new YAHOO.ext.grid.DefaultColumnModel([
            {header: "", width: 40, sortable: true},
            {header: "Absender", width: 130, sortable: true},
            {header: "Text", width: 330, sortable: true},
            {header: "Datum", width: 75, sortable: true},
            {header: "Art", width: 50, sortable: true},
            {header: "Anh&auml;nge", width: 85, sortable: true}
          ]);
    
          // create the Grid
          var grid = new YAHOO.ext.grid.Grid('message_list', dataModel, colModel);
          var start = new Date().getTime();
          grid.render();
        }
      }
    
      YAHOO.ext.EventManager.onDocumentReady(message_list.init, message_list, true);
    
    // ]]>
    </script>
    
    <div id="message_list" style="border: 1px solid #cccccc; overflow: hidden; width: 710px; height: 360px;"></div>

  2. #2
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    Tampa, FL
    Posts
    6,955
    Vote Rating
    16
    jack.slocum will become famous soon enough

      0  

    Default


    Selections are maintained by the row's id. In a DefaultDataModel, the default row id is the value in the first column. You will need to provide a function to return a true row id.

    Code:
    dataModel.getRowId = function(rowIndex){
          return (your id for this row);
    };
    The default is:

    Code:
    getRowId : function(rowIndex){
          return this.data[index][0];
    }

  3. #3
    Ext User
    Join Date
    Mar 2007
    Posts
    4
    Vote Rating
    0
    lsmith is on a distinguished road

      0  

    Default


    ah cool thx ..
    can i have a "hidden" column which i can use as the first column (or as the source of the unique row id)?
    seems like the easiest solution ..

  4. #4
    Sencha User
    Join Date
    Mar 2007
    Posts
    7,854
    Vote Rating
    2
    tryanDLS is on a distinguished road

      0  

    Default


    Yes. You can do something like:
    Code:
    var dm, cm, sm, grid, rowIndex=0;
    cm = new YAHOO.ext.grid.DefaultColumnModel(
    	[{header:'Index', hidden:true /*width:50*/},
    	 {header:'type', hidden:true},
    	 {header:'Name', width: 90},
    	 {header:'Code', width: 50},
    	 {header:'Viewable', width:65, editor:new YAHOO.ext.grid.CheckboxEditor(), renderer:renderBool}
    	]);
    	cm.defaultSortable = true;
    
    	// data schema.
    	// rowIndex is a dummy column that will hold an auto-generated row number
    	// __type will be hidden by the cm
    	var schema = {
    		root:'States',
    		id:'use-index',
    		fields: ['rowIndex', '__type', 'Name', 'Code', 'IsContentViewable']
    	};
    
    	dm = new YAHOO.ext.grid.JSONDataModel(schema);
    
    	dm.onLoad.subscribe(onLoad.createDelegate(this));	// handle data load event
    	dm.onLoadException.subscribe(showError.createDelegate(this));	// handle load error event
    
    	dm.addPreprocessor(0, function() {return ++rowIndex;});	// incr the rowIndex as each row is added
    	dm.on('beforeload', function() {rowIndex = 0;});  	// init the rowIndex before load
    	dm.loadData(data);

  5. #5
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    Tampa, FL
    Posts
    6,955
    Vote Rating
    16
    jack.slocum will become famous soon enough

      0  

    Default


    BTW, I couldn't help but notice you have the dreaded extra comma bug as well.

    ['[img]unread.jpg[/img]','Aril29','Lorem ...','12.11.2006','SMS',''],
    ['[img]read.jpg[/img]','Aril29','Lorem ...','12.11.2006','MMS','150kb'],
    ['[img]read.jpg[/img]','Aril29','Lorem ...','12.11.2006','MMS','120kb'], <-- extra comma
    ];

  6. #6
    Ext User
    Join Date
    Mar 2007
    Posts
    4
    Vote Rating
    0
    lsmith is on a distinguished road

      0  

    Default


    thx you so much!

  7. #7
    Ext User
    Join Date
    Mar 2007
    Posts
    4
    Vote Rating
    0
    lsmith is on a distinguished road

      0  

    Default


    one more question .. is there anywhere a description of the style sheet classes? specifically I have a few icons I need to display which have a greater height than the default. similarily i would like to vertical align things in the middle. so i guess the general question is what classes are useful when styling column cells?

  8. #8
    Sencha User
    Join Date
    Mar 2007
    Posts
    7,854
    Vote Rating
    2
    tryanDLS is on a distinguished road

      0  

    Default


    You could

    a) read the source and see how the HTML elements are built, or
    b) if you use FF and an extention like WebDeveloper you can mouseover html elements and see the css classes and html ids of any element.

    At some point the CSS files may get documented, but IMO, I would think that's a lower priority than getting all the code documented.

  9. #9
    Sencha User
    Join Date
    Apr 2012
    Location
    Austin, Texas
    Posts
    2
    Vote Rating
    0
    brian.moeskau is an unknown quantity at this point

      0  

    Default


    Using Firefox, install the Firebug (http://www.getfirebug.com/) extension and use the Inspect option to mouse over your page and examine css classnames, element ids, etc. on the fly. It will change the way you debug your pages, especially when trying to figure out foreign stylesheets and/or see how your style tags are getting rendered.

Similar Threads

  1. Problem with column sort
    By yevgen in forum Ext 1.x: Bugs
    Replies: 3
    Last Post: 2 Apr 2009, 2:32 AM
  2. Send sort column number in paged grid in Ext 1.0
    By JeffHowden in forum Community Discussion
    Replies: 3
    Last Post: 2 Jun 2008, 11:16 AM
  3. column sort makes ajax call for each time grid was recreated
    By lemontree in forum Ext 1.x: Help & Discussion
    Replies: 6
    Last Post: 4 Jul 2007, 2:14 AM
  4. Grid: Post column name (not just id) in remote sort
    By brondsem in forum Community Discussion
    Replies: 2
    Last Post: 18 Feb 2007, 4:01 PM
  5. Grid Sort for formatted date column in FF vs IE6
    By mrim in forum Ext 1.x: Help & Discussion
    Replies: 5
    Last Post: 31 Oct 2006, 8:28 PM

Thread Participants: 3

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar