jquery-mobilejquery-mobile-listviewjquery-mobile-grid

create a clickable table row using jquery mobile


I need a clickable "table" in my app. The closest I have gotten is using listviewer and links in combination with grid. The example below is what I need (a clickable tablerow and a separate button to the right). My problem is that I cant line up the "body-columns" with the "header-titles" becuase the button in my "table body" offsets the grid.

http://jsfiddle.net/lokkin/p9M8p/3/

    <!DOCTYPE html>
<html>

    <head>
        <title>Test</title>
        <meta name="viewport" content="width=device-width" />
        <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.0/jquery.mobile-1.4.0.min.css" />
        <script src="http://code.jquery.com/mobile/1.4.0/jquery.mobile-1.4.0.min.js"></script>
    </head>

    <body>
        <div data-role="page" id="index">
            <ul data-role="listview" data-split-icon="gear" data-inset="true">
                <li data-role="list-divider">
                    <div class="ui-grid-d">
                        <div class="ui-block-a">TRK</div>
                        <div class="ui-block-b">STATUS</div>
                        <div class="ui-block-c">NR</div>
                        <div class="ui-block-d">PFIX</div>
                        <div class="ui-block-e">EHNR</div>
                    </div>
                </li>
                <li> <a href="#Select" class="ui-grid-d">
                        <div class="ui-block-a">
                            TRUCK1
                        </div>
                        <div class="ui-block-b">
                            123
                        </div>
                        <div class="ui-block-c">
                            ABC123
                        </div>
                        <div class="ui-block-d">
                            456
                        </div>
                        <div class="ui-block-e">
                            789
                        </div>

                    </a>
 <a href="#Details" data-inline="true" data-transition="slide">Details</a>

                </li>
            </ul>
        </div>
    </body>

</html>

Solution

  • Just add right padding to the divider to match the listitems:

    .ui-li-divider{
        padding-right: 56px !important;
    }
    

    Updated FIDDLE