0

So basically, i'm actually doing a web app with html/css/javascript and im pretty much a beginner in it (i'm a c++/c# guy). I have seen many kind of solution already, but they always use stuff not related with actual ui-grid. So far, I made my headers (which won't change) and now i'm looking for a way to add rows in the grid. So, here is my headers :

<div class="ui-grid-a" id="currentgrid" style="height: 38px">
            <div class="ui-block-a">
                <div class="ui-grid-b">
                    <div class="ui-block-a">
                        <div class="ui-bar ui-bar-e">Info1</div>
                    </div>
                    <div class="ui-block-b">
                        <div class="ui-bar ui-bar-e">Info2</div>
                    </div>
                    <div class="ui-block-c">
                        <div class="ui-bar ui-bar-e">Info3</div>
                    </div>
                </div>
            </div>
            <div class="ui-block-b">
                <div class="ui-grid-b">
                    <div class="ui-block-a">
                        <div class="ui-bar ui-bar-e">Info4</div>
                    </div>
                    <div class="ui-block-b">
                        <div class="ui-bar ui-bar-e">Info5</div>
                    </div>
                    <div class="ui-block-c">
                        <div class="ui-bar ui-bar-e">Info6</div>
                    </div>
                </div>
            </div>
        </div>

And here is how i will call the js function to add the rows i will need

<a href="#" class="custom-button-style" onclick="find()" id="find" name="find">Search</a>

For exemple, if i can choose the number of rows added by changing only the value of a number in a loop, that could be awesome.

Help me =(

4
  • Should every 3 rows be grouped in ui-blocks? Commented Sep 17, 2015 at 18:41
  • @MacGruber, you may not want to nest classes this way. You have a class ui-block-a nested inside another ui-block-a Commented Sep 17, 2015 at 18:44
  • Stack Overflow is not a code writing website. We will not implement features for you. Please make an attempt at implementing the solution on your own, and if you get stuck post a question with a reproducible problem. At that point your question will be well received. In its current form, this post is simply asking for someone else to do your work for you. Commented Sep 17, 2015 at 18:45
  • @Travis J Sorry, thanks for the specification. Commented Sep 17, 2015 at 19:26

1 Answer 1

1

You can loop and append HTML-elements in this way:

for(var i = 1; i <= 10; i++) {
        $('#currentgrid').append('<div class="ui-bar ui-bar-e">Info'+i+'</div>');
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.