PDA

View Full Version : Grid and EXTJS 3



fmdano
7 May 2010, 8:13 AM
Hey all,
I am a coldfusion developer, and the new verion of CF using extjs 3.0 behind its grid. I am trying to customize my grid to pass multiple rows of data based around the user selecting checkboxes in the first column...does anyone have any ideas about how I might be able to do this using the extjs language? It seems like multiple selections in the grid are not the default, so I have to find a way to do that, so when I submit, all that are selected will pass...again I am just guessing about this, but I think it is right.

any help would be greatly appreciated...

dan

PS -- i really know almost nothing about extjs, so please make it simple to understand if you can :)

qwikso
7 May 2010, 10:41 AM
Hi, have you seen this example?
http://www.extjs.com/deploy/dev/examples/grid/grid-plugins.html

And ExtJS API docs:
http://www.extjs.com/deploy/dev/docs/?class=Ext.grid.CheckboxSelectionModel

Best regaards qwx

frankthetank
7 May 2010, 12:03 PM
Do like in the example, and use a grid with a store. When you modify something in the store, the record get modify. You can get all the modified rows on your store with the method getModifiedRecords().

Simply loop the records and send via Ajax to your cfm page to update/insert/delete.
With coldfusion 8+, you can do it by passing the Json to your coldfusion page.

fmdano
10 May 2010, 11:23 AM
I have looked at grid examples, and I am not really sure how to read that, and do what I need to do? I am very new to extjs, so i am not sure how to do what you are suggesting.
for the grid that has the checkboxes, here is the code:


var sm = new xg.CheckboxSelectionModel();

var grid2 = new xg.Grid3({

ds: new Ext.data.Store({

reader: reader,

data: xg.dummyData
}),

cm: new xg.ColumnModel([

sm,

{id:'company',header: "Company", width: 200, sortable: true, dataIndex: 'company'},

{header: "Price", width: 120, sortable: true, renderer: Ext.util.Format.usMoney, dataIndex: 'price'},

{header: "Change", width: 120, sortable: true, dataIndex: 'change'},

{header: "% Change", width: 120, sortable: true, dataIndex: 'pctChange'},

{header: "Last Updated", width: 135, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}

]),

sm: sm,

width:600,

height:300,

frame:true,

title:'Framed with Checkbox Selection and Horizontal Scrolling',

iconCls:'icon-grid',

renderTo: document.body
});


how do I read this and figure out how it works to make each checkbox click a row selection?

thanks for the help.

dan

fmdano
13 May 2010, 3:40 AM
Hey all,
Anyone have any ideas about my issues? I am struggling to figure out EXTJS and how to get it to work with Checkboxes in the grid. If the user checks a checkbox, that line needs to be selected...
I know how to do multiple selects with the shift or ctrl keys, but not trigger off a checkbox. I figure that is a listener, but I don't have any idea how to write one. I looked at the examples posted above, but I really don't
understand them.
Any help would be really appreciated. I am using ColdFusion 9 which uses extjs 3 behind their grid.
Dan