HI All,
I am totally new to skuid. What I am trying to do is :
- I have 2 fields on an Object, Division & Sub Division. There is no really dependency setup for these two fields.
- I created a tab view in skuid and tried to filter the rows by Division & SubDivision, Individually it worked good. But I wanted them to be dependent Like : If I select Division = APAC, The subdivision avaiable picklist values should be refreshed and show only APAC related subdivisions.
I figured out on myself that Custom JS is the only solution started up as below :
var params = argumentss0],
$ = skuid.$;
var productModel = skuid.model.getModel(‘Product2Data’);
var allProductData = ;
allProductData = productModel.data;
var i = 0;
for(i=0;i<allProductData.length;i++){
var productRow = allProductDataui];
}
// Static Code that I am looking to generate dynamically
var filterItems = ;
filterItems.push({ label: ‘Cheese’, value: ‘cheese’ });
filterItems.push({ label: ‘Pizza’, value: ‘pizza’ });
return filterItems;
Now I do get the Object in data and also get the proper length for allProductData array but next I want to do is traverse through the data and get the values for SubDivision field and put it in the array.
But I didnot find anything around it. i have 2 questions -
How to work on rows returned by data? what are its methods?
Is this right way to set the dependent filter?
I tried :
http://help.skuidify.com/m/models-conditions-filters/l/204980-use-a-snippet-as-a-filter-item-source-…
but its not my use case. Looking forward to and appreciate help from the community in advance.
Thanks,
You can start here… http://help.skuidify.com/m/11720/l/205447?data-resolve-url=true&data-manual-id=11720
Hi Moshe ,
thanks for your reply. I did refer to the link you posted before i got this question. Also I made some progress myself and was able to set the dependency. But I have a question now.
allProductData = productModel.data;
always give me 25 rows though there are more than 25 in the database. Is this a standard behaviour?
If your only getting 25 rows, you might have a condition on your model which is limiting the amount of rows, or you might have a LIMIT in the advanced properties of your model. As far as getting to the child records, make sure you select them in your model. Also I would suggest using the console to view the object along with it’s fields and properties. Try:
console.log(productModel);
you should be able to see all of the available data in the console (Ctrl + Shift + J in Chrome).
Regarding dependent picklists, you will probably want to use a field renderer. You might want to do something like this in a snippet that’s tied to your second picklist:
var field = argumentse0],
value = argumentsa1],
$ = skuid.$;
if(field.metadata.picklistEntries.length > 0){
skuid.ui.fieldRenderersifield.metadata.displaytype]field.mode;
}
basically you are passed the field and the values as argument 1 and 2 and you can do a lot of cool stuff with that.
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.