Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Header Title to Anchor Class #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion build/jqm.editable.listview.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@
ui.header = ui.wrapper.find('.ui-collapsible-heading')
ui.button = ui.header.find('a a, a button')
ui.content = ui.wrapper.find('.ui-collapsible-content')

// add anchor so I can attach identifying class
ui.anchor = ui.header.find('.ui-collapsible-heading-toggle');

ui.form = this._getForm();

$.extend(this, {
Expand Down Expand Up @@ -316,7 +320,10 @@
.children("a")[0]
.childNodes[0]
.data = (isListEmpty) ? opts.emptyTitle : opts.title;


// attached header title as class to enable custom styling to added later
ui.anchor.addClass(opts.title.replace(/\s+/g, ''));

// changing "Edit" button state, icon and label
ui.button.removeClass('ui-icon-minus ui-icon-' + opts.doneIcon + ' ui-icon-' + opts.addIcon + ' ui-icon-' + opts.editIcon)
.addClass('ui-icon-' + (this._editMode ? opts.doneIcon : isListEmpty ? opts.addIcon : opts.editIcon))
Expand Down
3 changes: 3 additions & 0 deletions demo/demo.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.Fruits {
background-color:#F29968 !important;
}
6 changes: 3 additions & 3 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
<script src="http://code.jquery.com/jquery-2.1.1.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquerymobile/1.4.2/jquery.mobile.js"></script>
<!-- <script src="../../jquery-mobile/dist/jquery.mobile.js"></script>-->
<!-- <script src="../build/jqm.editable.listview.js"></script>-->
<script src="../build/jqm.editable.listview.js"></script>-->
<script src="../js/collapsible-patched.js"></script>
<script src="../js/editable-listview.js"></script>
<!-- <script src="../js/editable-listview.js"></script>-->
</head>

<body style="padding: 20px">
Expand All @@ -44,7 +44,7 @@
<br>

<p>Delete <strong>"Orange"</strong> from the following list of <strong>"Fruits"</strong></p>
<ul id="list3" data-role="listview" data-editable="true" data-editable-type="simple" data-title="Fruits" data-empty-title="No Fruits">
<ul id="list3" data-role="listview" data-editable="true" data-editable-type="simple" data-title="Sweet Fruits" data-empty-title="No Fruits">
<li>Apple</li>
<li>Orange</li>
<li>Banana</li>
Expand Down