Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- listStreamWithTabsPage.methods.renderHeader = function($header){
- // core vars
- var self = this,
- page = this._getPage(),
- // use vars
- var title = self.getTitle() || page.route.query.title,
- description = 'Risus nullam eget felis eget. Donec enim diam vulputate ut pharetra sit. Sem integer vitae justo eget. Eget nunc scelerisque viverra mauris in. Viverra suspendisse potenti nullam ac tortor vitae. Cursus turpis massa tincidunt dui ut ornare lectus sit. Viverra accumsan in nisl nisi scelerisque.',
- tabChoices = [
- {id : 1, text: 'Opción 1'},
- {id : 2, text: 'Opción 2'},
- {id : 3, text: 'Opción 3'}
- ];
- // tempalte con titulo, descripción opcional y un tabs
- var templateHtml = `
- <div class="form-header">
- <div class="ms-Form-Title">` + title + `</div>
- <div class="ms-Form-Description">` + description + `</div>
- <div class="segmented" style="margin:20px auto; max-width:600px">
- <a class="button" segment-id="` + tabChoices[0].id + `" segment-text="` + tabChoices[0].text + `">` + tabChoices[0].text + `</a>
- <a class="button" segment-id="` + tabChoices[1].id + `" segment-text="` + tabChoices[1].text + `">` + tabChoices[1].text + `</a>
- <a class="button" segment-id="` + tabChoices[2].id + `" segment-text="` + tabChoices[2].text + `">` + tabChoices[2].text + `</a>
- </div>
- </div>
- `;
- // agregar html
- $header.html(templateHtml);
- // agregar al hacer click sobre botón
- $header.find('.segmented .button').on('click', function(e){
- var choice = this.getAttribute('segment-text'),
- query = '<Eq><FieldRef Name="Opciones" /><Value Type="Choice">' + choice + '</Value></Eq>';
- // manejar lógica para ver botón seleccionado
- $header.find('.segmented .button').removeClass('button-active');
- $(this).addClass('button-active');
- // self.requestItems() acepta como parametro una consulta CAML
- self.requestItems(query);
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement