Skip to content
This repository has been archived by the owner on Oct 9, 2018. It is now read-only.

Create/Update Action Bar Dynamically #311

Closed
tneil opened this issue Aug 30, 2012 · 28 comments
Closed

Create/Update Action Bar Dynamically #311

tneil opened this issue Aug 30, 2012 · 28 comments

Comments

@tneil
Copy link
Collaborator

tneil commented Aug 30, 2012

Create and modify an action bar dynamically after the screen has been inserted into the DOM

For the Action Bar:

  • show() [Completed]
  • hide() [Completed]
  • setSelectedTab(action) [Completed]
  • setBackCaption(caption) [Completed]

For an Action:

  • show() [Complete]
  • hide() [Complete]
  • setCaption(text) [Completed]
  • getCaption(); [Completed]
  • getAccentText();
  • setAccentText(value);
  • setImage(img) [Completed]
  • getImage(); [Completed]
  • enable() // Excludes tabs, tabs shouldn't be disabled, but the method will be stubbed out so there isn't an undefined error
  • disable() // Excludes tabs, tabs shouldn't be disabled, but the method will be stubbed out so there isn't an undefined error

General

  • Add sample page to show how to manipulate the control with JavaScript [Completed]
tneil pushed a commit that referenced this issue Sep 8, 2012
@tneil
Copy link
Collaborator Author

tneil commented Sep 8, 2012

setCaption() and setImage() have now been added for Action Items

tneil pushed a commit that referenced this issue Nov 6, 2012
Added setBackCaption to Action Bars #311, setOnCaption/setOffCaption to Toggle Buttons #315 and added show, hide, remove to Scroll Panels
@tneil
Copy link
Collaborator Author

tneil commented Nov 6, 2012

ActionBar setBackCaption() has now been implemented

@rrenna
Copy link

rrenna commented Nov 28, 2012

using setCaption() on an action seems to break my ActionBar, not sure if it's a mistake somewhere in my code or not. Leaving the Action bar to be labelled declaratively works perfectly.

@tneil
Copy link
Collaborator Author

tneil commented Nov 30, 2012

Can you explain more what you're referring to by break?

Are you able to post a screenshot of what you are seeing?

Can you list the device and OS version combination that you are using?

The examples in the bbUI samples for action bar manipulation are working, so I'm wondering what you're seeing.

@rrenna
Copy link

rrenna commented Nov 30, 2012

The issue was on my end, I'll update the comment to avoid confusion. Thanks Tim.

@tneil
Copy link
Collaborator Author

tneil commented Dec 1, 2012

Added setSelectedTab(), getCaption(),getImage()

@tneil
Copy link
Collaborator Author

tneil commented Dec 19, 2012

Added show() and hide()

@mtfranchetto
Copy link

I'm a BB10 developer, when are you planning to release this updates?

appendAction(action)
insertActionBefore(newAction, existingAction)

Thanks

@tneil
Copy link
Collaborator Author

tneil commented Dec 21, 2012

It will likely be sometime in January

@tneil
Copy link
Collaborator Author

tneil commented Jan 18, 2013

Started work on the show(), hide()... Keeping a todo list here..

  • Simple show/hide on action button [Complete]
  • Add data-bb-visible attribute for initial action visibility [Complete]
  • Simple show/hide on action overflow item [Complete]
  • Add data-bb-visible attribute for initial action overflow item visibility [Complete]
  • Simple show/hide on tab [Complete]
  • Add data-bb-visible attribute for initial tab visibility [Complete]
  • Simple show/hide on tab overflow item [Complete]
  • Add data-bb-visible attribute for initial tab overflow item visibility [Complete]
  • Handle shadowing on action overflow button when tab appears/disappears beside it [Complete]
  • General glitches with action overflow button issues when dynamically changing tab/action visibility [Complete]

@gcsantiago
Copy link

Simple show/hide on action button [Complete]

👍 stay walking... i will follow :)

@tneil
Copy link
Collaborator Author

tneil commented Jan 21, 2013

First revisions for show, hide for actions/tabs that are not in the overflow menus are checked in.. there are still bugs with the action overflow button appearing/disappearing when you sometimes call show,hide on the items. I think this is a padding issue where the action overflow button wraps to the below the action bar.

But if you aren't using the action overflow menu on your action bar, this first check-in should work not too bad. Still more work to do

@tneil
Copy link
Collaborator Author

tneil commented Jan 22, 2013

Checked in some progress.. the darn show/hide for main actions/tabs on the action bar are giving me grief. Especially when you have tab/action overflow buttons. Combine that with the initial data-bb-visible attribute and it's a bit of a mess.

I'm going to have to do some major surgery on the action sizing code. But I have some ideas on how I can structure it to make things simpler than they are now.

@gcsantiago
Copy link

never retreat, never surrender ! I appreciate your effort, and will be highlighted with my app behavior ! Thanks

@tneil
Copy link
Collaborator Author

tneil commented Jan 23, 2013

Making some pretty good progress today on the button/tab show and hide functions. Still some more tweaking yet, but I'm getting closer :o)

@tneil
Copy link
Collaborator Author

tneil commented Jan 23, 2013

Dynamic show/hide of actions is now checked in. The wiki has also been updated. All that we have left for action bars is enabled/disabled states for buttons :o)

Giddy-up!!

tneil pushed a commit that referenced this issue Jan 23, 2013
@thtro
Copy link

thtro commented Jan 24, 2013

Very good news! Thanks Tim!

@achan
Copy link

achan commented Jan 26, 2013

Is appending actions to the action bar still on the road map? Any suggestions on how to do this in the meantime?

I am adding tabs to the actionbar from onscreenready... is that supposed to work? The web inspector shows that my divs have been appended to the actionbar, but they are unprocessed.

@splatterb0y
Copy link

@achan
It will work if you add the markup in the onscreenready event, but not if you add it in the ondomready event because at this point all the markup is already processed by bbUI.js

 bb.init({onscreenready : function(element, id, params) {
        // Markup generated here will be processed by bbUI.js

       // Add markup with jQuery Example
       $("#selector", element).append('<input type="text"></input>');
     },
     ondomready: function(element, id, params) {
         // Markup generated here is not touched by bbUI.js
     }});
}, false);

@tneil
Copy link
Collaborator Author

tneil commented Jan 27, 2013

Correct, you should be able to manipulate adding/removing items in the onscreenready event. For the foreseeable future, I don't see the ability to add/remove/insert functions being available.

@rodnolan
Copy link
Contributor

This will work if you're hard coding the elements you want to add but you run into the issue described by @achan if you try to async load the page fragment. Maybe this idea #643 would solve that.

@achan
Copy link

achan commented Jan 27, 2013

That was exactly what I was doing @rodnolan. My temporary solution was to load the objects that would represent my tabs into localStorage and pull them from there in onscreenready.

@splatterb0y
Copy link

Can you please add the set/getAccentText?

@bert2002
Copy link

bert2002 commented Mar 8, 2013

Will it be possible to change the onclick event after the screen has been inserted into the DOM?

@tneil
Copy link
Collaborator Author

tneil commented Mar 8, 2013

@bert2002 you should be able to do that now by re-assigning the onclick

document.getElementById('myaction').onclick = function() {alert('hello world');};

@bert2002
Copy link

bert2002 commented Mar 8, 2013

@tneil oh that was easy and working as you said :) many thanks

@T-M-C
Copy link

T-M-C commented Apr 20, 2013

+1 for setAccentText(value)

@tneil
Copy link
Collaborator Author

tneil commented Jul 5, 2013

Closing this issue in favor of the new v1.0 markup and associated JavaScript interfaces based on issue #933

@tneil tneil closed this as completed Jul 5, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants