Highlighted

Swapping RemoteObject dataprovider on 2 grids

Avatar

Avatar

NightScholar

Avatar

NightScholar

NightScholar

29-09-2008

I'm at a loss, I've searched through the forums and
documentation and the only suggestion to get over this issue is to
run the validateNow() on the grid or the parent panel, neither
resolve my issue.



I can assigne the standard datagrid to a hardcoded array,
swap that hardcoded array with another and it works fine. The
remoteObject swap of dataprovider also works fine. As soon as I
change the standard datagrid to a remote object though one of the
grids to not repaint/refresh. I've also found that only the second
grid will refresh.



private var dataPool:String = "bamdev";

[Bindable] private var myArrayCollection:ArrayCollection;

[Bindable] private var detailTransactionAC:ArrayCollection;

[Bindable] private var dataGridResponder:DataGridResponder =
new DataGridResponder();

private var vantiveAllSql:String = "SELECT * FROM
OAD_VANTIVE_PR_SUM_V";

private var vantiveACSSql:String = "SELECT * FROM
OAD_VANTIVE_PR_SUM_V WHERE APPLICATION_ID IN ('ACS', 'CRM',
'OMS')";

private var transACSSql:String = "SELECT * FROM
OAD_TRANS_TEMP WHERE APPNAME = 'ACS'";

private function runStatement(stmnt:String,type:String):void

{

var token:AsyncToken =
remoteObj.getDataObjects(stmnt,dataPool);

switch (type) {

case "Vantive":

dataGridResponder.resultHandler = handleResponderResult;

break;

case "DetailTransaction":

dataGridResponder.resultHandler =
handleResponderResultDetailTransaction;

break;

default:

//currentState = "AppDetail_State";

//runStatement(vantiveACSSql);

//Alert.show("vantiveACSSql was run.");

break;

}

dataGridResponder.faultHandler = handleResponderFault;

// Now we pass the responder to the token that will call the
responder functions when the call to the

// RemoteObject is finished running the RPC

token.addResponder(dataGridResponder);

}



private function handleResponderResult(ev:ResultEvent):void

{

myArrayCollection = ev.result.resultset as ArrayCollection;

if (myArrayCollection.length== 0)

{

vantive_adg.dataProvider = vantiveBlankAC;

}

else

{

var g:Grouping = new Grouping();

g.fields = [new GroupingField("APP_TOTAL")];

var gc:GroupingCollection = new GroupingCollection();

gc.source = myArrayCollection;

gc.grouping = g;

gc.refresh();

vantive_adg.dataProvider = gc;

}

}

private function
handleResponderResultDetailTransaction(ev:ResultEvent):void

{

detailTransactionAC = ev.result.resultset as
ArrayCollection;

if (detailTransactionAC.length== 0)

{

detail_Transactions_dtg.dataProvider =
detailTransactionBlankAC;

}

else

{

detail_Transactions_dtg.dataProvider = detailTransactionAC;

}

}



private function handleResponderFault(ev:FaultEvent):void

{

Alert.show(ev.fault.getStackTrace(), "ERROR in
ExampleRemoteObjectUse.handleResponderFault");

}

public function onCreationComplete():void

{

runStatement(vantiveAllSql,"Vantive");

}

private function toggleAppDetail():void

{

switch (application_cb.selectedIndex) {

case 0:


detail_Transactions_dtg.dataProvider=detailTransactionBlankAC

//detail_Transactions_dtg.validateNow();

//DetailTransaction_pnl.validateNow();

runStatement(vantiveAllSql,"Vantive");

//vantive_adg.validateNow();

//SummVantive_pnl.validateNow()

break;

case 1:

runStatement(vantiveACSSql,"Vantive");

//vantive_adg.validateNow();

//SummVantive_pnl.validateNow()

runStatement(transACSSql,"DetailTransaction");

//detail_Transactions_dtg.dataProvider=appLocalTransactionAC


//detail_Transactions_dtg.validateNow();

//DetailTransaction_pnl.validateNow();

break;

}

}



[Bindable]

public var vantiveBlankAC:ArrayCollection = new
ArrayCollection([

{APP_TOTAL:"No Data Available(0)", VANTIVE_NUM:"0",
APPLICATION_ID:"No Data Available",
VAN_NUM_URL:"about:blank",LAST_UPDATE:"N/A", TEMP:"No Data
Available(0)"} ]);

[Bindable]

public var detailTransactionBlankAC:ArrayCollection = new
ArrayCollection([

{TRANSNAME:"No Data Returned",last_update: "N/A",
AVERSPTM:"N/A", AVERSPTMHEALTH:"0", COUNT:"N/A", COUNTHEALTH:"0"},
]);

[Bindable]

public var appLocalTransactionAC:ArrayCollection = new
ArrayCollection([

{TRANSNAME:"Transaction Summary", AVERSPTM:"157",
AVERSPTMHEALTH:"3", COUNT:"527", COUNTHEALTH:"3"},

{TRANSNAME:"IN-Check Compatibility And Set Product",
AVERSPTM:"121", AVERSPTMHEALTH:"4", COUNT:"527", COUNTHEALTH:"5"},

{TRANSNAME:"IN-Check Eligibility Rules", AVERSPTM:"90",
AVERSPTMHEALTH:"4", COUNT:"115", COUNTHEALTH:"3"},

{TRANSNAME:"IN-Create Interaction", AVERSPTM:"151",
AVERSPTMHEALTH:"2", COUNT:"215", COUNTHEALTH:"4"},

{TRANSNAME:"IN-Create Customer", AVERSPTM:"121",
AVERSPTMHEALTH:"4", COUNT:"42", COUNTHEALTH:"2"},

{TRANSNAME:"IN-Get Negotiated Products", AVERSPTM:"90",
AVERSPTMHEALTH:"5", COUNT:"527", COUNTHEALTH:"5"},

{TRANSNAME:"IN-Get Negotiated Assigned Product",
AVERSPTM:"151", AVERSPTMHEALTH:"3", COUNT:"412", COUNTHEALTH:"4"},

{TRANSNAME:"IN-Get Quote", AVERSPTM:"121",
AVERSPTMHEALTH:"4", COUNT:"187", COUNTHEALTH:"2"},

{TRANSNAME:"IN-Get Available Appointments", AVERSPTM:"90",
AVERSPTMHEALTH:"5", COUNT:"10", COUNTHEALTH:"1"},

{TRANSNAME:"IN-Get Customer Details", AVERSPTM:"151",
AVERSPTMHEALTH:"3", COUNT:"127", COUNTHEALTH:"3"},

{TRANSNAME:"IN-Submit Order Action", AVERSPTM:"121",
AVERSPTMHEALTH:"2", COUNT:"112", COUNTHEALTH:"3"},

{TRANSNAME:"IN-Search Customer", AVERSPTM:"90",
AVERSPTMHEALTH:"4", COUNT:"127", COUNTHEALTH:"2"},

{TRANSNAME:"IN-Update Customer", AVERSPTM:"90",
AVERSPTMHEALTH:"5", COUNT:"22", COUNTHEALTH:"3"}

]);

]]>



</mx:Script>

Replies

Highlighted

Avatar

Avatar

NightScholar

Avatar

NightScholar

NightScholar

29-09-2008

I found my issue, I needed to create an additional
datagridresponder, it must be a one for one for each
datagrid.