POST
|
Rene, Thanks again for the follow up. Your method works in an environment of one application generating and defining the two grids. My problem is that the floating datagrids are separate, generated in one widget by two different functions but each defined in it's own title window. So in my environment, my problem is that I can't access the second grid from the first grid. In other words, I need to be able to access Datagrid 2 from Datagrid1 in the item click event of datagrid1, and I keep getting the null object error 1009. The first grid is created thusly: private function showGridResults(event:MouseEvent):void
{
try
{
if(!gridFields){
showMessage("No Datagrid configured for this layer", false);
return;
}
if(!myfloatdg){
myfloatdg = rbeWidgetFloatDG(PopUpManager.createPopUp(map,rbeWidgetFloatDG,false));
PopUpManager.centerPopUp(myfloatdg);
}else{
PopUpManager.addPopUp(myfloatdg,map,false);
PopUpManager.centerPopUp(myfloatdg);
}myfloatdg.ownerWidget = this;
} My second data grid is created as follows: private function showResultsWindow():void
{
// resultsWindow.dgData.dataProvider = gridDataProvider;
resultsWindow = ResultsWindowPub(PopUpManager.createPopUp(map, ResultsWindowPub, false));
resultsWindow.dgData.dataProvider = busStopData;
resultsWindow.visible = true;
resultsWindow.inUse = true;
resultsWindow.move(10, map.height - 295);
}
private function filterrecAC(item:Object):Boolean {
if(String(item.STOP_ID)== "0"){
return false;
}
return true;
} I've tried to apply your code in the first floating datagrid's item click event. Problem is accessing the data in second datagrid. I can import it into the first data grid import com.esri.solutions.flexviewer.widgets.ResultsWindowPub but I keep getting a null object error no matter how many ways I try to access the dataprovider of the second datagrid, although it will appear in FlexBuilder, e.g. var vRB:ResultsWindowPub = _bWidget as ResultsWindowPub;
dg2Source = vRB.dgData.dataProvider as ArrayCollection; But I keep getting the null object error 1009 at that point, so that the code that I adapted from your suggestion is never even tested in this environment.
... View more
09-16-2010
10:49 AM
|
0
|
0
|
313
|
POST
|
Rene, Thanks for the response. I will try to apply your suggestions, although I am not sure that it applies directly to my problem. I get all the results that I need, as I need them (I don't want to limit the results in the second datagrid to just the filtered items based on selection in the first grid) I would like to be able to select a row in datagrid 1 that would result in the related records in datagrid 2 being selected (I can work out a filter later on as an additional user generated event). To rephrase the question in hopefully simpler terms: I have two title windows with datagrids that have unique datasources in one widget. Datagrid 1 has a datasource that is composed of graphic attributes that are the result of query. Datagrid 2 has a datasource that is actually the result of a WebService operation (contentHandler(event) with resultFormat = "object" (this is the only way I could get floating datagrid2 to work). The link between the two datasources is the contents of one field(datagrid1 "STOP_ID", datagrid2 "STOPID"). I may be grabbing at straws here, since I am hoping for database functionality in rest api. I am pretty close though, so hopefully I can get it done. Thanks, Jim Faron
... View more
09-15-2010
11:53 AM
|
0
|
0
|
313
|
POST
|
I have modified a widget to have two floating datagrids. One datagrid (datagrid 1) is a copy of Robert's floating datagrid, related to the source widget in the same manner as the SearchWidget Floating DG is to the SearchWidget. I have a second 'simple' floating datagrid (datagrid 2) composed of records that are related to the records in datagrid1, received from a sql database via a webservice. So, there is a one to many relationship between the datagrids, datagrid 1 having singular records bound to graphic attributes on the map, datagrid 2 having many event records from a database. The data has one field to use as a link field or foreign key: datagrid 1:'STOP_ID' to datagrid2:'STOPID'. The question I have is how to create a bind between the datagrids so that when a user selects a record in datagrid 1, the related records in datagrid 2 will also be selected (i.e. highlighted)? I have combed the internet and I cannot find anything quite like this: there are a lot of examples of binding two datagrids on one datasource, or creating a second datasource on selected values from a first datasource in the same application, but what I am hoping to do is more like a database query, i.e. two distinct datasources linked by the value in one attribute field. As always, any help or pointers are greatly appreciated. Jim Faron Austin Independent School District Austin, TX
... View more
09-15-2010
10:10 AM
|
0
|
4
|
2672
|
POST
|
Dasa, That was it! Thanks again for your help! Jim Faron
... View more
09-10-2010
12:39 PM
|
0
|
0
|
299
|
POST
|
Yes, you are correct. The featureset.Attributes has three fields: Name, Policy, and Stop_id. I only want the Stop_id in the comma separated list variable. I intend to use that variable to send to a Webservice in a script. I can make the Webservice and script work by using the selectedItem of a list (I define the labelField=Stop_ID). I want to send multiple values, in fact all of the values each time the function is run. If there is another way to do this, I would love to know. For example, if there is a better way to get the text value of the one field (Stop_ID) that is contained in featureSet.attributes, that would be fantastic. I would rather not, if I don't have to, limit featureSet.Attributes to one field only in the function (the fields are defined in the config.xml), as that would affect its use as a dataProvider for a grid.
... View more
09-10-2010
12:18 PM
|
0
|
0
|
299
|
POST
|
Dasa, I changed the relevant code according to your suggestion (params.push(myString), and it is starting to do what I expect. However the results now appears as "null642473,null6424730,null6424730685840,null64247306858401,null642473068584011869369etc'. Each value being with 'null' contains the first value with an incremental increase from the next value (with the addition of a 0). What I am aiming at is to return 642473,685840,11869369 etc(as underlined above). I can't manually create the string because it is the result of dynamic function, so that the results will change everytime the function is called. It seems that the 'myString' loop is the problem. It is intended to display the text value of the ArrayCollection objects (otherwise I would trace [Object,object]. var stopAC:ArrayCollection = new ArrayCollection;
var newObj:Object;
var j:int=0;
for(j=0;j<featureSet.attributes.length; j++)
{
newObj = featureSet.attributes ;
delete newObj.NAME;
delete newObj.POLICY;
stopAC.addItem(newObj);
}
var params:Array = new Array;
for each( var obj:Object in stopAC )
{
for each( var obj2:Object in obj )
{
myString += String( obj2 );
params.push(myString);
}
}
var paramsCSV:String = params.join(",");
trace(paramsCSV); Seems like I'm getting closer, but I am definitely missing something. Thanks, Jim Faron
... View more
09-10-2010
11:37 AM
|
0
|
0
|
299
|
POST
|
I am trying to create a variable that will show the string value of an Array object deliminated with a comma. In short, I have created an ArrayCollection from FeatureSet.Attributes, modified it as in the code below (from Dan yesterday), and then applied a 'for each' statement to create the string values. All well and good, but the values that are returned are not delimited (I need a comma separating the values so that I can use it as a variable in a script). I created an Array composed of the string output (myString in code), and I applied the conventional methods to return comma separated values (params.toString(); and then params.join(","), but the results are the same: I get the values of the Array strung together without a delimiter. function onRbeResult(featureSet:FeatureSet, token:Object = null):void
{
try
{
for each (var gra:Graphic in featureSet.features)
{
var obj:Object = gra.attributes;
obj["gid"] = gid;
gid +=1;
}
gridDataProvider = featureSet.attributes;
LLdata.dataProvider = gridDataProvider;
var recAC:ArrayCollection = createRbeRecordData(featureSet,rbeID);
wRepeater.dataProvider = recAC;
var stopAC:ArrayCollection = new ArrayCollection;
var newObj:Object;
var j:int=0;
for(j=0;j<featureSet.attributes.length; j++)
{
newObj = featureSet.attributes ;
delete newObj.NAME;
delete newObj.POLICY;
stopAC.addItem(newObj);
}
for each( var obj:Object in stopAC )
{
for each( var obj2:Object in obj )
{
myString += String( obj2 );
}
}
trace(myString);
var params:Array = new Array(myString);
// var paramsCSV:String = params.toString();//didn't work
var paramsCSV:String = params.join(",");//didn't work either
Alert.show(paramsCSV);
trace(paramsCSV); The result of the trace is always as follows (the results change dynamically, but no change in format): null0642473168584021869369384069146424735691143668584076662168642473 What I am looking for is e.g.642473,685840,1869369,etc. Perhaps the null value is creating a problem, or the code is wrong. Any help or pointers will be greatly appreciated, as always. Jim Faron
... View more
09-10-2010
10:02 AM
|
0
|
6
|
599
|
POST
|
Dan, That was it! Thanks so much for the help. Jim Faron
... View more
09-09-2010
12:17 PM
|
0
|
0
|
168
|
POST
|
Basically I need to create an ArrayCollection composed of one field in a featureSet of a result function. I complicated this task (code below) in order to help see what I was trying to get by creating a dataProvider for a list, e.g. LLdata.dataProvider = featureSet.attributes; The labelField of the list is 'Stop_ID'. The list works as expected. But, I need to create an arrayCollection composed of that field (Stop_ID) for another purpose (I don't need the list). I'm sure that I am missing something simple. Any help or pointer will be greatly appreciated. The code that I am using may not be necessary to answer this, but I am including it if it might clarify. function onRbeResult(featureSet:FeatureSet, token:Object = null):void
{
try
{
for each (var gra:Graphic in featureSet.features)
{
var obj:Object = gra.attributes;
obj["gid"] = gid;
gid +=1;
}
gridDataProvider = featureSet.attributes;
LLdata.dataProvider = featureSet.attributes;
// createRbeRecordData(featureSet,rbeID);//original
var recAC:ArrayCollection = createRbeRecordData(featureSet,rbeID);
wRepeater.dataProvider = recAC;
var stopAC:ArrayCollection = LLdata.dataProvider as ArrayCollection;
for each( var obj:Object in stopAC )
{
for each( var obj2:Object in obj )
{
myString += String( obj2 );
}
}
Alert.show(myString); Thanks, Jim Faron
... View more
09-09-2010
10:25 AM
|
0
|
3
|
551
|
POST
|
Robert, You bailed me out once again. I chased this one up and down the Internet, not thinking or finding about creating an ArrayCollection or adding the extra data provider. Hopefully this solution will find its way into the blogoshpere for other lost souls. Thanks again, Jim Faron Austin Independent School District
... View more
06-01-2010
12:48 PM
|
0
|
0
|
163
|
POST
|
I adopted Robert's Search Widget with drop-down as in this thread:http://forums.esri.com/Thread.asp?c=158&f=2421&t=289747&mc=6#msgid901640. I then updated the Search Widget with floating Datagrid, and I thought that all was good, until I discovered that the child box (id DropDownSel) exhibits strange behavior as follows, and as demonstated graphically in the attached pdf. If I do not actually select an item in the 'child' box (id DropDownSel), and then I navigate the Parent (combo Box id cboLayerText) to a different layer source , only the first item will appear as expected in the 'child' box, but when you select the dropdown arrow, it populates with items from the prior layer source, i.e. the prior layer list, which is defined in the SearchXML as <dropdown>. What is stranger still, if I click on one of those values from the prior list, the actual value that loads is from the current 'parent' layer list, and the list in the combobox is refreshed. I have tried various code fixes involving refresh, and even extended the combo box following advise from a blog post, but I cannot get this to work correctly. Another way of putting this is that the user must make a selection of an item in the child list other than the first item, or if he/she navigates the Search layer parent list to another layer, the values in the child box will not load as expected, as described above. The pdf demonstrates this with screen shots. I know that combo box controls are the source of frequent issues with Flash, but I hope that someone can suggest a fix. Thanks, Jim Faron Austin Independent School District
... View more
06-01-2010
10:22 AM
|
0
|
2
|
475
|
POST
|
Ken, Thanks for the response. The QueryBuilderWidget was written with mFldValues as a bindable array, and the adaptation to eliminate the duplicate values, utilizing push() method. I have tried to wrap the array into an arrayCollection, but in lieu of changing too much code that works, it would be great if there were a way to sort both numbers and text utilizing the compare functions. I may be out of luck here. I will look into modifying the code to work with replacing the Array with an ArrayCollection, but I don't know why the designer of the widget did not do that from the beginning, since it seems that there are better options working with ArrayCollection than Array. Thanks, Jim Faron
... View more
04-30-2010
09:03 AM
|
0
|
0
|
207
|
POST
|
Robert, Yes, that was it. I was close: I did not include the myfloatdg.graphicslayer = graphicsLayer; , I only input the columns and aliases below 'myfloatdg.datagrid.dataProvider.removeAll(); Thanks again for the help. Jim Faron Austin Independent School District Austin, TX
... View more
04-30-2010
05:13 AM
|
0
|
0
|
127
|
POST
|
I can sort the values of the returned fields in the QueryBuilder Widget from the new Sample Viewer if the value is a string by calling a sortByAttribute function (see code below), and I can sort field if the value is numeric by calling the sortNumeric function (see below). My problem is that I need to be able to do both. I can do one or the other, and I will get a debugging error if, say I use the sortByAttribute function and load values for a number field, and vice versa if I use the sortNumeric function and load values from a string field. I haven't been able to make the script work by calling both functions using various attempts with 'if else'. Any help will be greatly appreciated. private function onFieldValuesRereivalsuccess(obj:Object):void{
mqbMessage = "Values has been retreived."
CursorManager.removeBusyCursor();
var fset:FeatureSet = obj as FeatureSet;
mqbMessage = "";
// mFldValues = fset.features;
mFldValues2 = fset.features;
var fldname:String = fieldsLst.selectedItem.Name
var contains:Boolean;
mFldValues = new Array();
for ( var i:Number = 0; i<mFldValues2.length; i++ )
{
contains = false;
for ( var j:Number = 0; j<mFldValues.length; j++ )
{
var item1:String = mFldValues2.attributes[fieldsLst.selectedItem.Name];
var item2:String = mFldValues .attributes[fieldsLst.selectedItem.Name];
if (item1 == item2) contains = true;
}
if (!contains)
{
mFldValues.push(mFldValues2);
}
}
mFldValues.sort(sortByAttribute);
}
//COMPARE FUNCTION
private function sortByAttribute(a:Object, b:Object):Object
{
var x:String = a.attributes[fieldsLst.selectedItem.Name].toLowerCase();
var y:String = b.attributes[fieldsLst.selectedItem.Name].toLowerCase();
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
}
private function sortNumeric(a:Object, b:Object):int
{
var value1:Number = a.attributes[fieldsLst.selectedItem.Name];
var value2:Number = b.attributes[fieldsLst.selectedItem.Name];
return ((value1 < value2) ? -1 : ((value1 > value2) ? 1 : 0));
} Thanks, Jim Faron Austin Independent School District Austin, TX
... View more
04-29-2010
01:08 PM
|
0
|
2
|
695
|
POST
|
This question is probably best answered by Robert, if not only answerable by Robert. For the sake of my education if not also sanity, can you tell me what portion of either the SearchWidget or SearchWidgetFloatingdg pertains to the bug fix regarding populating an open floating datagrid when changing the data with a new search? I believe this happened in version 1.06. I am deriving a floating datagrid for another widget, and I haven't been able to find a way to populate the open datagrid when changing the data returned by the query. Thanks, Jim Faron
... View more
04-28-2010
12:50 PM
|
0
|
2
|
514
|
Title | Kudos | Posted |
---|---|---|
1 | 03-09-2023 07:05 AM | |
1 | 06-25-2021 08:54 AM | |
1 | 06-25-2021 08:35 AM | |
1 | 06-27-2022 02:18 PM | |
7 | 06-24-2021 03:26 PM |
Online Status |
Offline
|
Date Last Visited |
04-13-2023
10:27 AM
|