Ask a Question related to Macromedia Flex General Discussion, Design and Development.
-
kchamarthi #1
Finding out if any modifications are being made in thefields in an editable datagrid
Hi,
I populated my data grid with an array
collection(initDG=event.result.categorydtls.catego ry) where initDGObject is the
array collection.I made the data grid as editable.Now , when the user click's
on submit(below data grid), the request for modifying the corresponding details
in database should go only if the user makes any modification ,or else an alert
should be shown saying that "you havent made any modifications".For this
purpose i assigned "event.result.categorydtls.category" to another array
collection initDGObject and ,in the function which will be invoked after
clicking on submit i compared both the objects initDG and initDGObject.But to
my surprise,if any field in data grid is modified then both initDG and
intiDGObject(here let me remind that i assigned initDG as the data provider for
grid and initDGObject is a normal array collection object for which the details
are assigned to for comparison purpose) are also modifying.So i am unable to
check if any modifications are being made before forwarding request for
database modification to back end.Please suggest me a solution for doing this
task.Thanks in advance.
//Function for populating datagrid
public function subcategoriesResults(event:ResultEvent):void {
Alert.show("Iam in the result handler for getDetails");
//var res:String;
var xArray:Array;
objCat=null;
initDG=null;
try
{
//Alert.show("Value is:"+event.message.body.toString());
initDGObject=event.result.categorydtls.category;
initDG=event.result.categorydtls.category;
subCategories.dataProvider=initDG;
}
catch(error:Error){
//Alert.show("Sorry you have no subcategories");
try{
objCat=event.result.categorydtls.category;
objToCheck=objCat;
subCategories.dataProvider=objCat;
}
catch(error:Error){
Alert.show("Sorry you have no subcategories");
subCategories.dataProvider=null;
}
}
}
//Function which checks if any modifications are done and forwards request
based on that
public function updateSubCategory():void {
var msg:String = "";
var flag:Number=0;
if(initDG != null){
if(initDG.length>1){
//Alert.show("the message is here");
var
check:int=ObjectUtil.compare(initDGObject,subCateg ories.dataProvider,0);//comapr
ing the two arraycollection objects
Alert.show(check.toString());
if(check!=0)
{
for (var i:Number=0; i<initDG.length; i++)
{
if(initDG[i].catg_status=="I" || initDG[i].catg_status=="A")
{
msg += initDG[i].catg_name + "," + initDG[i].catg_desc+"," +
initDG[i].catg_status+","+initDG[i].catg_id+"#";
}
else
{
Alert.show("I(Inactive) and A(Active) are the only characters allowed for
the category status");
getDetails(storeParent);
return;
}
}
}
else
{
Alert.show("Please edit the category details before clicking on
Submit");
return;
}
}
}
else if(objCat!=null)
{
if((objToCheck.catg_name==objCat.catg_name) &&
(objToCheck.catg_desc==objCat.catg_desc) &&
(objToCheck.catg_status==objCat.catg_status))
{
Alert.show("Please edit the topic details before clicking on submit");
return;
}
if(objCat.catg_status=="I" || objCat.catg_status=="A")
msg += objCat.catg_name + "," + objCat.catg_desc+"," +
objCat.catg_status+","+objCat.catg_id+"#";
else
{
Alert.show("I(Inactive) and A(Active) are the only characters allowed for
the category status");
getDetails(storeParent);
return;
}
}
//Alert.show("Message is"+msg);
var objParams:Object = new Object ();
objParams.msg=msg;
subCategoriesUpdateServ.url=subCatUrl+"?submit=upd ate";
subCategoriesUpdateServ.send(objParams);
//Alert.show("msg========="+msg);
}
kchamarthi Guest
-
DataGrid EditItemCommand : must click twice to make DataGrid Editable
Hey- I am having trouble with a simple datagrid example, and need some advice if anyone is knowledgable. It's really driving me batty! I've... -
Making editable datagrid.
Hi all i am new to asp.net. i have one application where i am filling value from database to datagrid. What i want is whenever user click on... -
Editable Datagrid
I have a challenge, that I do not seem to be able to solve. I have an "overview"-page that presently displays data from 2 columns in a database... -
Editable rows....... for datagrid....
Does anybody point me to datagrid sample with editable cell ? rudy -
DataGrid / FDataGrid modifications
Hello Flashers, I've posted some modifications to the FDataGrid component that some might be interested in. Unfortunately, it's not free, but it... -
atta707 #2
Re: Finding out if any modifications are being made inthe fields in an editable datagrid
[url]http://blog.paranoidferret.com/index.php/2007/08/24/flex-php-json-mysql-advanced-updating/[/url]
Essentially, you'll be listening for collection change event for your collection.
ATTA
atta707 Guest
-
kchamarthi #3
Re: Finding out if any modifications are being made inthe fields in an editable datagrid
Thanks for that reply..It worked when the datagrid is populated with an array
collection...but when the datagrid is populated with an object(which is the
case when a single record is to be displayed in datagrid)it is not possible
since we cant add an event listener for an object.Please suggest me a solution.
kchamarthi Guest
-
atta707 #4
Re: Finding out if any modifications are being made inthe fields in an editable datagrid
You could always add that single object into a array collection. That's what, by the way, what data grid does for you implicitly.
ATTA
atta707 Guest
-
kchamarthi #5
Re: Finding out if any modifications are being made inthe fields in an editable datagrid
lam not able to add a single object to the array collection.Regarding the usage
of datagrid in my task,there will be a drop down on the top of datagrid with
categories(like science,maths...)in it.Whenever a particular category is
selected then the corresponding subcategories(in category science sub
categories are physics,biology.....)details will be populated in the
datagrid.Please suggest me a solution.
kchamarthi Guest



Reply With Quote

