<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to add css to table inside a popup modal in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-css-to-table-inside-a-popup-modal/m-p/435178#M124109</link>
    <description>&lt;P&gt;Here is the code where I am inserting the csss&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; define([
        'underscore',
        'backbone',
        'jquery',
        'splunkjs/mvc',
        'splunkjs/mvc/searchmanager',
        'splunkjs/mvc/simplexml/element/table',
        ], function(_, Backbone, $, mvc, SearchManager, TableElement) {
        var modalTemplate = "&amp;lt;div id=\"pivotModal\" class=\"modal\"&amp;gt;" +
                            "&amp;lt;div class=\"modal-header\" style=\"font-size:14px;\"&amp;gt;&amp;lt;b&amp;gt;&amp;lt;%- title %&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/div&amp;gt;" +
                            "&amp;lt;div class=\"modal-body\"&amp;gt;&amp;lt;/div&amp;gt;" +
                            "&amp;lt;div class=\"modal-footer\"&amp;gt;&amp;lt;button "+
                            "class=\"dtsBtn close\"&amp;gt;Close&amp;lt;/button&amp;gt;&amp;lt;/div&amp;gt;" +
                            "&amp;lt;/div&amp;gt;" +
                            "&amp;lt;div class=\"modal-backdrop\"&amp;gt;&amp;lt;/div&amp;gt;";

        var ModalView = Backbone.View.extend({

            defaults: {
                title: 'Not Set'
            },

            initialize: function(options) {
                this.options = options;
                this.options = _.extend({}, this.defaults, this.options);
                this.childViews = [];
                this.template = _.template(modalTemplate);
                console.log('Success: ' + this.options.title);
            },

            events: {
                'click .close': 'close',
                'click .modal-backdrop': 'close'
            },

            render: function() {
                var data = { title : this.options.title }
                this.$el.html(this.template(data));
                return this;
            },

            show: function() {
                $(document.body).append(this.render().el);

                $(this.el).find('.modal-body').append('&amp;lt;div id="modalVizualization"/&amp;gt;');

                $(this.el).find('.modal').css({
                width:'80%',
                height:'auto',
                left: '9%',
                top: '14%',
                'margin-left': '0',
                'max-height':'100%',
                'background-color':'#f5f5f5',
                border: '2px solid #00BFFF'
                });

                /*$(this.el).find('table table').css({});
                $(this.el).find('table thead').css({});
                $(this.el).find('table tbody').css({});
                $(this.el).find('table th').css({});
                $(this.el).find('table td').css({});
                $(this.el).find('table tr').css({});*/

                $(' table td').css({ 'padding': '3px', 'text-align': 'center'});

                $(' table table').css({'border-collapse': 'collapse', 'width': '100%', 'font-family': 'arial', 'font-size': '10px', 'margin-left':'20px'});

                $(' table th').css({'position': 'absolute', 'top': '-9999px !important', 'left': '-9999px !important'});

                $( table tr').css({'border-radius': '12px', 'width': '10%', 'display': 'inline-block', 'margin-right': '8px', 'margin-bottom': '8px'});

                $(' table td').css({  'border': 'none', 'position': 'relative', 'padding-left': '12%', 'text-align': 'left'});

                $(' table td:before').css({'position': 'absolute', 'top': '6px', 'left': '6px', 'width': '45%', 'padding-right': '5px', 'white-space': 'nowrap'});


                var search = mvc.Components.get(this.options.search.id);
                console.log(search);
                var detailTable = new TableElement({
                id: "detailTable",
                managerid: search.name,
                pageSize: "10",
                el: $('#modalVizualization')
                }).render();



                this.childViews.push(detailTable);
                search.startSearch();


                },

            close: function() {
                this.unbind();
                this.remove();

                _.each(this.childViews, function(childView){
                childView.unbind();
                childView.remove();
                });
            }

        });

        return ModalView;
    });
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 04 Jun 2018 09:59:58 GMT</pubDate>
    <dc:creator>mjlsnombrado</dc:creator>
    <dc:date>2018-06-04T09:59:58Z</dc:date>
    <item>
      <title>How to add css to table inside a popup modal</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-css-to-table-inside-a-popup-modal/m-p/435177#M124108</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;I have created a dashboard with a pop-up modal, I want to add css on the table inside the pop up modal, the problem is i do not know how can I set a class/id to the table inside the pop up can someone help me with this.&lt;/P&gt;

&lt;P&gt;thanks in advance.&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/5114i37BB699DB85C40C8/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt; &lt;/P&gt;</description>
      <pubDate>Mon, 04 Jun 2018 09:02:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-css-to-table-inside-a-popup-modal/m-p/435177#M124108</guid>
      <dc:creator>mjlsnombrado</dc:creator>
      <dc:date>2018-06-04T09:02:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to add css to table inside a popup modal</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-css-to-table-inside-a-popup-modal/m-p/435178#M124109</link>
      <description>&lt;P&gt;Here is the code where I am inserting the csss&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; define([
        'underscore',
        'backbone',
        'jquery',
        'splunkjs/mvc',
        'splunkjs/mvc/searchmanager',
        'splunkjs/mvc/simplexml/element/table',
        ], function(_, Backbone, $, mvc, SearchManager, TableElement) {
        var modalTemplate = "&amp;lt;div id=\"pivotModal\" class=\"modal\"&amp;gt;" +
                            "&amp;lt;div class=\"modal-header\" style=\"font-size:14px;\"&amp;gt;&amp;lt;b&amp;gt;&amp;lt;%- title %&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/div&amp;gt;" +
                            "&amp;lt;div class=\"modal-body\"&amp;gt;&amp;lt;/div&amp;gt;" +
                            "&amp;lt;div class=\"modal-footer\"&amp;gt;&amp;lt;button "+
                            "class=\"dtsBtn close\"&amp;gt;Close&amp;lt;/button&amp;gt;&amp;lt;/div&amp;gt;" +
                            "&amp;lt;/div&amp;gt;" +
                            "&amp;lt;div class=\"modal-backdrop\"&amp;gt;&amp;lt;/div&amp;gt;";

        var ModalView = Backbone.View.extend({

            defaults: {
                title: 'Not Set'
            },

            initialize: function(options) {
                this.options = options;
                this.options = _.extend({}, this.defaults, this.options);
                this.childViews = [];
                this.template = _.template(modalTemplate);
                console.log('Success: ' + this.options.title);
            },

            events: {
                'click .close': 'close',
                'click .modal-backdrop': 'close'
            },

            render: function() {
                var data = { title : this.options.title }
                this.$el.html(this.template(data));
                return this;
            },

            show: function() {
                $(document.body).append(this.render().el);

                $(this.el).find('.modal-body').append('&amp;lt;div id="modalVizualization"/&amp;gt;');

                $(this.el).find('.modal').css({
                width:'80%',
                height:'auto',
                left: '9%',
                top: '14%',
                'margin-left': '0',
                'max-height':'100%',
                'background-color':'#f5f5f5',
                border: '2px solid #00BFFF'
                });

                /*$(this.el).find('table table').css({});
                $(this.el).find('table thead').css({});
                $(this.el).find('table tbody').css({});
                $(this.el).find('table th').css({});
                $(this.el).find('table td').css({});
                $(this.el).find('table tr').css({});*/

                $(' table td').css({ 'padding': '3px', 'text-align': 'center'});

                $(' table table').css({'border-collapse': 'collapse', 'width': '100%', 'font-family': 'arial', 'font-size': '10px', 'margin-left':'20px'});

                $(' table th').css({'position': 'absolute', 'top': '-9999px !important', 'left': '-9999px !important'});

                $( table tr').css({'border-radius': '12px', 'width': '10%', 'display': 'inline-block', 'margin-right': '8px', 'margin-bottom': '8px'});

                $(' table td').css({  'border': 'none', 'position': 'relative', 'padding-left': '12%', 'text-align': 'left'});

                $(' table td:before').css({'position': 'absolute', 'top': '6px', 'left': '6px', 'width': '45%', 'padding-right': '5px', 'white-space': 'nowrap'});


                var search = mvc.Components.get(this.options.search.id);
                console.log(search);
                var detailTable = new TableElement({
                id: "detailTable",
                managerid: search.name,
                pageSize: "10",
                el: $('#modalVizualization')
                }).render();



                this.childViews.push(detailTable);
                search.startSearch();


                },

            close: function() {
                this.unbind();
                this.remove();

                _.each(this.childViews, function(childView){
                childView.unbind();
                childView.remove();
                });
            }

        });

        return ModalView;
    });
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 Jun 2018 09:59:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-css-to-table-inside-a-popup-modal/m-p/435178#M124109</guid>
      <dc:creator>mjlsnombrado</dc:creator>
      <dc:date>2018-06-04T09:59:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to add css to table inside a popup modal</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-css-to-table-inside-a-popup-modal/m-p/435179#M124110</link>
      <description>&lt;P&gt;@mjlsnombrado you can override the Table CSS directly from Simple XML or an independent CSS file using &lt;CODE&gt;Simple XML CSS Extension&lt;/CODE&gt;, without having to depend on jquery to add &lt;CODE&gt;CSS()&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Looking at you code you can add the following in Dashboard to test:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  &amp;lt;row depends="$alwaysHideCSSPanel$"&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;html&amp;gt;
        &amp;lt;style&amp;gt;
          #detailTable table td{
            padding: 3px; 
            text-align: center
          }

          #detailTable table table{
            border-collapse:collapse;
            width: 100%;
            font-family: arial;
            font-size: 10px;
            margin-left:20px
          }

          #detailTable table th{
            position: absolute;
            top: -9999px !important;
            left: -9999px !important
          }

          #detailTable table tr{
            border-radius: 12px;
            width: 10%;
            display: inline-block;
            margin-right: 8px;
            margin-bottom: 8px
          }

          #detailTable table td{
            border: none;
            position: relative;
            padding-left: 12%;
            text-align: left
          }

          #detailTable table td:before{
            position: absolute;
            top: 6px;
            left: 6px;
            width: 45%;
            padding-right: 5px;
            white-space: nowrap
          }
        &amp;lt;/style&amp;gt;
      &amp;lt;/html&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;PS: I think &lt;CODE&gt;display: inline-block;&lt;/CODE&gt; should be &lt;CODE&gt;display: inline-grid;&lt;/CODE&gt; but not sure about your final layout. So you would need to test and apply yourself.&lt;BR /&gt;
Once you are done testing you can move the code in &lt;CODE&gt;&amp;lt;style&amp;gt;...&amp;lt;/style&amp;gt;&lt;/CODE&gt; block to separate css file and keep it clubbed along with JS for modal view.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jun 2018 13:39:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-css-to-table-inside-a-popup-modal/m-p/435179#M124110</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-06-04T13:39:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to add css to table inside a popup modal</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-css-to-table-inside-a-popup-modal/m-p/435180#M124111</link>
      <description>&lt;P&gt;Hi @nicketnilay,&lt;/P&gt;

&lt;P&gt;Thanks for answering I've tried your suggestion but it does not produce result the table inside the popup is still the same.  &lt;/P&gt;</description>
      <pubDate>Tue, 05 Jun 2018 00:52:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-css-to-table-inside-a-popup-modal/m-p/435180#M124111</guid>
      <dc:creator>mjlsnombrado</dc:creator>
      <dc:date>2018-06-05T00:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to add css to table inside a popup modal</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-css-to-table-inside-a-popup-modal/m-p/435181#M124112</link>
      <description>&lt;P&gt;@mjlsnombrado when the modal pop up appears can you use Browser Inspector Tool to get the CSS Selector for the table and verify with the selectors I have used?&lt;/P&gt;

&lt;P&gt;Is the issue with CSS style or data not showing up in Modal table?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jun 2018 01:42:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-css-to-table-inside-a-popup-modal/m-p/435181#M124112</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-06-05T01:42:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to add css to table inside a popup modal</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-css-to-table-inside-a-popup-modal/m-p/435182#M124113</link>
      <description>&lt;P&gt;Hi @nicketnilay, the issue is with the CSS not applying to the table inside the modal, I've just removed the contents because it contains sites/info and I'm not sure if I'm allowed to share it so I just remove it, I've already used the inspector tool and it shows the table attributes inside the modal is the same with the normal Splunk table and when I edit these attributes it applies to all the tables on the dashboard, what I want is to apply an id/class to the table inside the popup modal so that it will not affect the other tables but I do not know how can I apply an id to the table inside the modal, the modal view I am using is based on the hurricane labs. thanks  &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="https://www.hurricanelabs.com/splunk-tutorials/splunk-custom-modal-view-creation-part-1-revealing-a-path-toward-enhanced-visibility-and-functionality"&gt;https://www.hurricanelabs.com/splunk-tutorials/splunk-custom-modal-view-creation-part-1-revealing-a-path-toward-enhanced-visibility-and-functionality&lt;/A&gt; &lt;/P&gt;</description>
      <pubDate>Wed, 06 Jun 2018 00:56:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-css-to-table-inside-a-popup-modal/m-p/435182#M124113</guid>
      <dc:creator>mjlsnombrado</dc:creator>
      <dc:date>2018-06-06T00:56:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to add css to table inside a popup modal</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-css-to-table-inside-a-popup-modal/m-p/435183#M124114</link>
      <description>&lt;P&gt;It worked, I've used the other i.d.  #modalVizualization and created an inline css thanks  Nicketnilay &lt;/P&gt;</description>
      <pubDate>Wed, 06 Jun 2018 07:59:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-css-to-table-inside-a-popup-modal/m-p/435183#M124114</guid>
      <dc:creator>mjlsnombrado</dc:creator>
      <dc:date>2018-06-06T07:59:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to add css to table inside a popup modal</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-css-to-table-inside-a-popup-modal/m-p/435184#M124115</link>
      <description>&lt;P&gt;You are referring to great blog and its author can be summoned on Slack Chat or Splunk answers @rjthibod &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jun 2018 12:32:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-css-to-table-inside-a-popup-modal/m-p/435184#M124115</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-06-06T12:32:38Z</dc:date>
    </item>
  </channel>
</rss>

