You need to sign in to do that
Don't have an account?
JBall
Dependent Picklists in Flex
Has anyone successfully applied a bitmask for dependent picklists in Flex? I'm trying to port the dependent picklists example in the API documentation by tweaking the Bitset class as described below, and modifying the reporting loop to one that will work in Flex. It's applying the bitmask, but the indexes aren't matching up correctly.
Code:
Code:
public class Bitset { private var data:ByteArray; public function Bitset(data:String) { this.data = new ByteArray(); this.data.writeUTFBytes(data); } public function testBit(n:int):Boolean { return (data[n>>3] & (0x80 >> n % 8)) != 0; } public function size():int { return data.length * 8; } }//end class Bitset
i'm also interested in how you went about displaying the dependent picklist in Flex.
thanks
To get the picklist values, I'm using a describe SObjects call. I've added a "Rejection Reason" field to the Lead object in my developer account, which is dependent upon the Status field. The describe call returns the following result for "Rejection Reason"
Code: The Status picklist has not been modified. The dependency is as follows:
Open-Not Contacted:
Working-Contacted: Signed With Competitor
Closed-Converted:
Closed-Not Converted: Erroneous Data
Signed with competitor
To test dependency, I'm currently looping through the picklist entries so they each have the controller name, and converting the String validFor field to a Bitset validFor field (newItem.validFor = new Bitset(field.picklistValues[f].validFor);). I then use the following filter function to determine if a dependent should be displayed:
Code:
Both the controlling and dependent picklists are ComboBoxes using the picklistValues ArrayCollections as their data providers. On a change, the controller calls dependent.dataprovider.refresh() to cause the filter function to re-evaluate. Rignt now, I'm not as interested in efficiency as I am functionality.
Thanks,
John
first i added your field and field dependancies to my lead object
then i added Bitset to the library
your port works correctly.
Code:
then i used the test harness (salesforce.mxml) and replaced describeSObjects_CB with this code
(and changed the describe to call ["Lead"])
Code:
and here is my output on the console:
Code:
i didn't go back and use your loops, or create your filter function , but i think you can see how the bit set is indexed from this test code. Let me know if you agree that this is working.
thanks again for your detailed code and problem description.
I know I'm re-opening this thread rather late in the game, but I've only just had time to return to it. It appears we prematurely accepted the results of the bitmask. You'll notice Erroneous Data is true for a single controlling field value, but it's the wrong value! It should be Closed - Not Converted that's the true value. I'm getting the same results.
Code:
I don't know how long it would have taken me before I'd thought of that!