Skip to content

Commit

Permalink
redme modified with more details and checks added in logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Amogh.Shah committed Nov 11, 2022
1 parent 889cb2e commit 1976978
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,22 @@ Use this pluggable widget widget to dynamically set the active tab page. The def
## Features
- Dynamically open tab page
- Get tab page number on which user has clicked
- Tested on Mendix 8.18.19, 9.1.1, 9.6.0, 9.7.0 and 9.15.1
- Tested on Mendix 8.18.19, 9.1.1, 9.6.0, 9.7.0, 9.11.0 and 9.15.1

## Demo and Playground
Try-out this widget by visiting https://tabselectorwidgetapp-sandbox.mxapps.io/

## Usage
- Create a Mendix app
- Add a Data View
- Add a Data View and set the data source (this data source should have a attribute which will determine the number of active tab page)
- Add a Tab Container inside the Data View
- Add the this widget inside the Data View
- Configure the widget by docuble clicking on it:
- Enter the name of the target Tab Container
- Select the attribute to determine tab page number. The first tab page number is always 1.
- Run the app, now based on attribute the tab page will be selected by default.

## Limitations
This widget should be used inside a data container, we cannot use Microflow as data source to determine active page number this is due to limitation from Mendix pluggable widgets. As of now there is no direct way to get return value form Microflow in pluggable widgets. See https://forum.mendix.com/link/questions/95035

## Issues, suggestions and feature requests
Suggestions, feedbacks and issues are always welcome :) [here](https://github.com/mendixlabs/TabPageSelector/issues)
Suggestions, feedbacks, contributions and issues are always welcome :) [here](https://github.com/mendixlabs/TabPageSelector/issues)
6 changes: 3 additions & 3 deletions src/TabPageSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ export default class TabPageSelector extends Component<TabPageSelectorContainerP
if(li == null)
{
console.debug("Determined tab page index is: " + this.props.paneIndexByAttr!.value);
console.error("Unable find tab page index by specified index.")
console.error("Unable find tab page index by specified index.");
}

li.click()
if(li!=null)
li.click()
}
}
}
15 changes: 7 additions & 8 deletions src/TabPageSelector.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<widget id="mendix.tabselector.TabSelector" pluginWidget="true" needsEntityContext="true" offlineCapable="true"
<widget id="mendix.tabpageselector.TabPageSelector" pluginWidget="true" needsEntityContext="true" offlineCapable="true"
supportedPlatform="Web"
xmlns="http://www.mendix.com/widget/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mendix.com/widget/1.0/ ../node_modules/mendix/custom_widget.xsd">
Expand All @@ -8,18 +8,17 @@
<icon/>
<properties>
<propertyGroup caption="General">
<property key="paneIndexByAttr" type="attribute" required="false">
<property key="targetTabCtrl" type="string" required="true">
<caption>Tab container name</caption>
<description>Enter target tab container name.</description>
</property>
<property key="paneIndexByAttr" type="attribute" required="true">
<caption>Select Attribute</caption>
<description>Select the attribute which indicates the tab page number. First tab page is always 1.</description>
<attributeTypes>
<attributeType name="Integer"/>
</attributeTypes>
</property>

<property key="targetTabCtrl" type="string">
<caption>Tab container name</caption>
<description>Enter target tab container name.</description>
</property>
</property>
</propertyGroup>
</properties>
</widget>
4 changes: 2 additions & 2 deletions typings/TabPageSelectorProps.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ export interface TabPageSelectorContainerProps {
class: string;
style?: CSSProperties;
tabIndex?: number;
paneIndexByAttr?: EditableValue<BigJs.Big>;
targetTabCtrl: string;
paneIndexByAttr: EditableValue<BigJs.Big>;
}

export interface TabPageSelectorPreviewProps {
class: string;
style: string;
paneIndexByAttr: string;
targetTabCtrl: string;
paneIndexByAttr: string;
}

0 comments on commit 1976978

Please sign in to comment.