RE: cfgrid flash form question

2005-12-02 Thread Artur Kordowski
Hi Nick,

I haven't tested it yet but it should work this way:

cfformitem type=script
function check_batch_state()
{

if(batchType.dataProvider[batchType.selectedIndex]['Adjustment_Batch_Type']=
'IND')
{
myButton.enabled = false;
// if that bellow don't work try this
_root.myButton.enabled = false;
}
}
/cfformitem

BTW: If you want to know more about the methods or properties of the
elements, take a look into the
Flex ActionScript and MXML API Reference
http://livedocs.macromedia.com/flex/15/asdocs_en/asdoc-title.html

Cheers, Artur



-Original Message-
From: Nick Han [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 02, 2005 12:10 AM
To: CF-Talk
Subject: cfgrid flash form question

Hi All, I am using a cfgrid flash type.

 

 

cfgrid name=batchType

  height=200

  width=410

  vspace=10

  selectmode=edit

  query=GetAdjustmentBatchTypes

  insert=Yes

  insertbutton=Add New Type

  delete=yes 

  onchange=check_batch_state()

 

cfformitem type=script

   function check_batch_state(){

 
if(batchType.dataProvider[batchType.selectedIndex]['Adjustment_Batch_Typ
e']='IND'){

I NEED TO DISABLE THE DELETE BUTTON IF
THIS ROW IS SELECTED

}

 

   }

   /cfformitem

 

I want to be able to disable the 'delete' button via script, if the user
selects a certain row.  Any idea how I can reference the delete button since
it is auto generated by cfgrid when you set 'delete=yes'?





~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:225905
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Re: cfgrid flash form question

2005-12-02 Thread Felipe Fernandes
Nick, the best way is to use a cfinput type=button to delete the
rows insted of the auto genereted del of the grid.
This code also popup´s an confirmation alert to confirm the delete:


cfsavecontent variable=actionDelete
 var batchType = batchType
var myClickHandler = function (evt)
{
if (evt.detail == mx.controls.Alert.YES)
{   
var item = batchType.selectedItem;
if(_global.backupDP != undefined)
{
for(var i = 0; i  _global.backupDP.length; i++)
{
if(_global.backupDP[i] == item)
{
_global.backupDP.removeItemAt(i);
}
}
}
GridData.deleteRow(batchType);
}
}

//set the font color and button labels of all alerts
_global.styles.Alert.setStyle(color, 0xFF);
mx.controls.Alert.cancelLabel = No!;
mx.controls.Alert.yesLabel = Yes;

//create the alert
var qtexto = 'Tem certeza que deseja excluir o livro \n\n' +
batchType.selectedItem.titulo.toUpperCase();
var myAlert = mx.controls.Alert.show(qtexto, Confirmação,
mx.controls.Alert.YES | mx.controls.Alert.CANCEL,  box1, 
myClickHandler);
/cfsavecontent

And the button would be something like this:

 cfinput type=button name=removesub value=Excluir
onclick=#actionDelete# enabled={(batchType.selectedItem.id !=
undefined  batchType.selectedItem.id != 'what you don´t want it to
be')} /

I used the batchType.selectedItem.id but I don´t know the columns of
your grid so you may have to change  the 'id' for some existing row.
If you want the code to do the insert button just ask.

Felipe

~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:225948
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


RE: cfgrid flash form question

2005-12-02 Thread Nick Han
Felipe, 
  Thank you!  I thought about doing it that way too but I didn't know enough 
Flex and actionscript to make that happen.

  Can I ask you another question?  What if I wanted to disable (gray out) a row 
in the cfgrid when 'selectmode=edit'?
 

-Original Message-
From: Felipe Fernandes [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 02, 2005 8:42 AM
To: CF-Talk
Subject: Re: cfgrid flash form question

Nick, the best way is to use a cfinput type=button to delete the
rows insted of the auto genereted del of the grid.
This code also popup´s an confirmation alert to confirm the delete:


cfsavecontent variable=actionDelete
 var batchType = batchType
var myClickHandler = function (evt)
{
if (evt.detail == mx.controls.Alert.YES)
{   
var item = batchType.selectedItem;
if(_global.backupDP != undefined)
{
for(var i = 0; i  _global.backupDP.length; i++)
{
if(_global.backupDP[i] == item)
{
_global.backupDP.removeItemAt(i);
}
}
}
GridData.deleteRow(batchType);
}
}

//set the font color and button labels of all alerts
_global.styles.Alert.setStyle(color, 0xFF);
mx.controls.Alert.cancelLabel = No!;
mx.controls.Alert.yesLabel = Yes;

//create the alert
var qtexto = 'Tem certeza que deseja excluir o livro \n\n' +
batchType.selectedItem.titulo.toUpperCase();
var myAlert = mx.controls.Alert.show(qtexto, Confirmação,
mx.controls.Alert.YES | mx.controls.Alert.CANCEL,  box1, 
myClickHandler);
/cfsavecontent

And the button would be something like this:

 cfinput type=button name=removesub value=Excluir
onclick=#actionDelete# enabled={(batchType.selectedItem.id !=
undefined  batchType.selectedItem.id != 'what you don´t want it to
be')} /

I used the batchType.selectedItem.id but I don´t know the columns of
your grid so you may have to change  the 'id' for some existing row.
If you want the code to do the insert button just ask.

Felipe



~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:225957
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Re: cfgrid flash form question

2005-12-02 Thread Felipe Fernandes
Nick, I don´t think you can disable an specific row in a grid but you
can use form fields and binds insted of the editable grid, take a look
at tihs:
www.larousse1.com.br/edita
It´s a CMS in flash forms that i did.
Go at 'livros' under 'catalogo' at the menu and you will see a nice
example of what I´m talking about.
When you select a row in the grid it populates the fileds in the
second panel for you edit them with this aproach you can enable and
disable the editing panel as you wish.
If you want I can give you some help.

Felipe

On 12/2/05, Nick Han [EMAIL PROTECTED] wrote:
 Felipe,
   Thank you!  I thought about doing it that way too but I didn't know enough 
 Flex and actionscript to make that happen.

   Can I ask you another question?  What if I wanted to disable (gray out) a 
 row in the cfgrid when 'selectmode=edit'?


 -Original Message-
 From: Felipe Fernandes [mailto:[EMAIL PROTECTED]
 Sent: Friday, December 02, 2005 8:42 AM
 To: CF-Talk
 Subject: Re: cfgrid flash form question

 Nick, the best way is to use a cfinput type=button to delete the
 rows insted of the auto genereted del of the grid.
 This code also popup´s an confirmation alert to confirm the delete:


 cfsavecontent variable=actionDelete
  var batchType = batchType
 var myClickHandler = function (evt)
 {
 if (evt.detail == mx.controls.Alert.YES)
 {
 var item = batchType.selectedItem;
 if(_global.backupDP != undefined)
 {
 for(var i = 0; i  _global.backupDP.length; i++)
 {
 if(_global.backupDP[i] == item)
 {
 _global.backupDP.removeItemAt(i);
 }
 }
 }
 GridData.deleteRow(batchType);
 }
 }

 //set the font color and button labels of all alerts
 _global.styles.Alert.setStyle(color, 0xFF);
 mx.controls.Alert.cancelLabel = No!;
 mx.controls.Alert.yesLabel = Yes;

 //create the alert
 var qtexto = 'Tem certeza que deseja excluir o livro \n\n' +
 batchType.selectedItem.titulo.toUpperCase();
 var myAlert = mx.controls.Alert.show(qtexto, Confirmação,
 mx.controls.Alert.YES | mx.controls.Alert.CANCEL,  box1, 
 myClickHandler);
 /cfsavecontent

 And the button would be something like this:

  cfinput type=button name=removesub value=Excluir
 onclick=#actionDelete# enabled={(batchType.selectedItem.id !=
 undefined  batchType.selectedItem.id != 'what you don´t want it to
 be')} /

 I used the batchType.selectedItem.id but I don´t know the columns of
 your grid so you may have to change  the 'id' for some existing row.
 If you want the code to do the insert button just ask.

 Felipe



 

~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:225978
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54