How do I clone the 'PRINT' button drop down and functionality? I want to create new list of prinatable lets call that PRINT2 and only list certain printables there
Since we can't have dependent filter based on value of field, I can have predefined filter for those dropdown it will only show them. The reason is we have long list of printables and we want to organize them. Thank you!
Like
If the system has a lot of printables you could try the approach of adding a lookup to select and run a printable (since then they have a searchable list). I did this for a system a long time ago and worked great.
I have the code here: https://gist.github.com/RyanFarley/46a9fe7513ff927ed6d66ed3fc0f0137
The end result was this:
Also, for the system I did this for, we only checked the "show in edit page" option for the common printables so they still showed in the print menu as a much shorter list, but all the rest were available in the lookup.
Ryan
Hello Tony,
You can clone Print button and apply filters by following these steps:
1. add the button to your page;
2. add collection attribute and bind button menu items to it
attributes: { "CardPrintMenuItemsTest": { dataValueType: Terrasoft.DataValueType.COLLECTION } }
diff: /**SCHEMA_DIFF*/[ { "operation": "insert", "name": "TestButton", "values": { "itemType": 5, "caption": "Print Test", "style": "blue", "controlConfig": { "menu": { "items": { "bindTo": "CardPrintMenuItemsTest" } } } }, "parentName": "LeftContainer", "propertyName": "items", "index": 10 }
3. set the value of created collection attribute in the source code
methods: { onEntityInitialized: async function() { this.callParent(arguments); var testStringValue = this.get("UsrTestString"); setTimeout(this.initCustomPrintButton(testStringValue), 3000); }, initCustomPrintButton: function(val){ var printItems = this.get(this.moduleCardPrintFormsCollectionName); printItems.collection.items = printItems.collection.items.filter(x => x.values.Caption.includes(val)); this.set("CardPrintMenuItemsTest", printItems); } }