Last active
August 29, 2015 14:07
-
-
Save dacur/6166696a960b26b437d8 to your computer and use it in GitHub Desktop.
User uses dropbox to select a search term. Clicks button to initialize search. Any result that does not match will have class 'displayNone' applied to it. (Build function runs first, displays journals) ****OPTIONAL: call from on change instead of on click. When dropdown state changes, the function will be called. See code below.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function SortJournalsWho(){ | |
| _selectedWho = $('#journalWhoTagSort option:selected').val(); | |
| $('.journalWho').each(function(){ | |
| if($(this).html()!=_selectedWho){ | |
| $(this).parent().addClass('displayNone'); | |
| } | |
| }); | |
| } | |
| function BuildCompletedJournals(data){ | |
| // alert(JSON.stringify(data)); | |
| var i = 0; | |
| var html = ''; | |
| for(i=0; i<data.length; i++){ | |
| var journal = data[i]; | |
| var date = moment(journal.JournalDate).format("MMM Do YYYY"); | |
| // alert(journal.ID); | |
| html += '<div class="journalRow" id="' + journal.ID + '">'; | |
| html += '<div class="journalName">' + journal.Title + '</div>'; | |
| html += '<div class="journalDate">' + date + '</div>' | |
| html += '<div class="journalHidden journalWho">' + journal.Who + '</div>' | |
| html += '<div class="journalHidden journalWhat">' + journal.What + '</div>' | |
| html += '</div>' | |
| } | |
| $('#journalsList').html(html); | |
| $('.journalRow').on('click', function(){ | |
| _journalIDEditing = $(this).attr('id'); | |
| // alert(_goalIDEditing); | |
| EditCompletedJournal(data); | |
| MovePageLeft('#pageJournalCreate', _currentPage); | |
| }); | |
| } | |
| // *******OPTIONAL to sort on change instead of btn click. Put this in page load JS. | |
| $('#journalWhoTagSort').change(function(){ | |
| SortJournalsWho(); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment