PDA

View Full Version : Grid and Checkbox problem



rTankersley
18 Aug 2011, 11:38 AM
I'm having two problems with grids. First, I'm trying to add a checkbox to it. However, it is adding two rows of checkboxes, rather than just one I have no idea why. Here is the grid code:


var sm = Ext.create('Ext.selection.CheckboxModel');
Ext.define('ModuleHome.view.grids.threadListGrid', {
extend: 'Ext.grid.Panel',
alias: 'widget.threadListGrid',
forceFit: true,
store: 'threadListStore',
title: 'List of Threads',
selModel: sm,
columns: [
{header: 'Title', dataIndex: 'title'},
{header: 'Author', dataIndex: 'author'},
{header: 'Created', dataIndex: 'created'},
{header: 'Number of Replies', dataIndex: 'replies'}
]
});


Secondly, I'm having an error where the grid's information does not show up at the beginning. It has the column headers, but no data. However if I open/close a firebug console, it shows up! It does this when autoloading or loaded manually at launch. Firebug shows a call to the server for information, even when the data is not showing. Then I close firebug and magically the information shows up!

Anyway know why this could be?

stevil
18 Aug 2011, 12:21 PM
1) Try removing the first list, and change selModel: sm to




selType: 'checkboxmodel',



2) Is the store 'threadListStore' set up before you define the grid?
2a) I get what you're trying to do in establishing a more encapsulated view in the grid definition, but usually you see stores and columns defined when you create an instance instead of defining the subclass. Can you try referencing the store id when you create the grid instead of when you define it and see if anything changes?
2b) I'm wondering if declaring a Store AND a column set is causing problems, as columns are usually defined on the store.

stevil

rTankersley
20 Aug 2011, 8:29 AM
I got it figured out. I wasn't ever declaring a height or anything to help with it. I guess firebug was changing the height, making the grid rethink its idea on how much room it had, and adjusting to where it was showing. Silly mistake that took a couple of hours of frustration, but solved now!

Thanks for your help, especially on the checkbox model thing. Strangely just following the code in the examples, which is what I did, didn't work.

börn
6 Feb 2012, 6:33 AM
I also have the problem that in one case I've two columns for the checkboxmodel. Does anyone know, why this happens?

My config is:


{
xtype: 'mygrid',
padding:'0 0 10 0',
storePath:field.name,
columns:subModel.widgetConfig,
tbar:subModel.actions,
selModel : {
selType: 'checkboxmodel',
mode: 'MULTI'
}
}


I suppose it has something to do with my call to reconfigure of the grid... so i declared my grid with a checkboxmodel selection model at first and without a store, then somewhat later, i add my store to the grid by calling reconfigure. After that i see two checkbox columns :(

börn
7 Feb 2012, 2:53 AM
okay it's a bug... with version 4.1-b2 everything works fine.