locked
jquery using group by RRS feed

  • Question

  • User932259438 posted

    Hi.

    I have more div and I want use show/hide where = ID


    First div has id={ID}. From first table retrieve ID

    I need to check where need to display each ID and then append.



    My code:

    $(function () {
        var ticker = $.connection.stockTicker; // the generated client-side hub proxy
        var $stockTable = $('#dvTable');
        var rowTemplate = '<div class="box box-widget"><div class="box-header with-border"><div class="user-block"><img class="img-circle" src="{imgcircle}" alt="User Image"><span class="username"><a href="#">{FullName}</a></span><span class="description">Shared publicly - {DateByPost}</span></div></div></div>'+
        '<div class="box-body" id="{ID}" style="display: block;"><img class="img-responsive show-in-modal" src="{uplaodphoto}" style="display:{uplaodphoto}" alt="Photo"><p>{Post}</p><button type="button" class="btn btn-default btn-xs"><i class="fa fa-share"></i> Share</button><button type="button" class="btn btn-default btn-xs"><i class="fa fa-thumbs-o-up"></i> Like</button><span class="pull-right text-muted">127 likes - 3 comments</span></div>'
        
        
        var comment= '<div id="{CommentId={"CommentId"}}" class="box-footer box-comments" style="display: block;"><div class="box-comment"><img class="img-circle img-sm" src="img/Friends/guy-2.jpg" alt="User Image"><div class="comment-text" id="{CommentId}"><span class="username">Maria Gonzales<span class="text-muted pull-right">8:03 PM Today</span></span>{Message}</div></div>';
    
    
                   
            
            
            //<div id="row{ID}"><div id="dvPost{ID}">{Post}</div><div id="dvUpdate{ID}">Update</div><div style="display:none" id="dvUpdateConfirm{ID}">UpdateConfirm</div><div id="dvDelete{ID}">Delete</div><div id="dvReply{ID}">Reply</div><div style="display:none" id="dvConfirmReply{ID}">Confirm Reply</div><div id="dvReplies{ID}">{replies}</div></div>';
    
        var $stockTable2 = $('#dvTable22');
        var rowTemplate2 = '<div id="row{ID}"><div id="dvPost{ID}">{Post}</div>';
    
        
        function formatStock(stock) {
            return $.extend(stock, {
                Id: stock.Id
            });
        }
    
        function init() {
            return ticker.server.getAllStocks().done(function (stocks) {
                $($stockTable).empty();
    
                $.each(stocks, function () {
                    var stock = formatStock(this);
                    $stockTable.append(rowTemplate.supplant(stock));
                    $stockTable.append(comment.supplant(stock));
                   // var test = $(".comment-text").attr("id")
    
                   // if (test)
    
    
                });







    Sunday, January 14, 2018 10:49 AM

All replies

  • User1400794712 posted

    I have more div and I want use show/hide where = ID


    First div has id={ID}. From first table retrieve ID

    I need to check where need to display each ID and then append.

    According to the code, it's not clear about the usage of {ID}. And what do you mean about the requirement above? Could you please post more details here then I can understand your needs better.

    Best Regards,

    Daisy

    Tuesday, January 16, 2018 10:48 AM