Skip to main content
Participating Frequently
May 29, 2008
Answered

CFGRID: Attaching an add button

  • May 29, 2008
  • 1 reply
  • 1635 views
I am currently running Coldfusion 8 and I've been trying to use cfgrid to write a database manipulator. The problem I am experiencing is I use:

insert="yes"
insertButton="Add"

But when I run the code the "Add" button does not display and I can not perform an insert into the database. Everything I've seen online says this should work but I am at a loss for why it isn't. Any suggestions would be great!
This topic has been closed for replies.
Correct answer The_ScareCrow
Ken, thanks for the reply but I am having some issues with your code. I've played with the new Ext.PagingToolbar() code but all I can get it to do is replace the add button completely. Also, the loading button never stops loading. I first implemented your code as show below, but no luck. Temporarily I added the add button to the Header Panel without an issue but I still would like to try getting it to the Footer. I am going to continue to research but if you have any idea where I am going wrong with implementing your code, let me know. I appreciate the help!


Here is a working example for you.
Note that I have a js variable called pageSize. I use a cfparam by the same name to hold a value for this and use it in both the js and the cfgrid.

Ken

Note:
If you actually want the "add" button to insert straight into the grid, do a google search on ext grid insert or go to the ext web site and look at the examples. There is one in there.

1 reply

Inspiring
May 29, 2008
A read of the cf docs for cfgrid indicates that the insert button is only valid for the applet format.

You will need to add a button using the underlying ext grid functions.

Ken
Participating Frequently
May 30, 2008
Thanks for the advice, I actually figured that out but using query="" instead of bind="", now I am looking into doing an add button using ext. Last time I did an add button I could only get it to do an add button in the top tool bar of the grid, but I want to try and do it on the bottom where the delete button is but I can't figure it out.

Can you alter the bottom tool bar of cfgrid using ext?
Participating Frequently
May 30, 2008
So currently I've altered my init function to add in a new button "Add" by way of var bbar = new Ext.Toolbar(gridFoot) I can attach the button but it completely destroys all of the previous buttons. What I want to do is just append the new button to the current tool bar, is this possible?

I've attached the code below: