0

I have list in which i add three functionality on ("Append ", "review").Button are on rows and on row click ?Actually i am on second page but i am calling third page on all case but doing something different .But problem is the it goes to third page then return to first page ..Here is my code..?

     $(document).on('click', '.review_h', function(event) {


               event.stopPropagation();
                ROW_ID = $(this).closest(".documentRowID").attr("id");
               var ipAd= window.localStorage.getItem("IP_ADDRESS");
               if(ipAd==''||ipAd==null){
                navigator.notification.alert("Please configure IP Address.");
                return;
            }
                getDocumentValue();


               alert("review click");
               setTimeout(function(){
            readRtfFile();
          },100);


             $.mobile.changePage($("#realTimeScreen"));

        });

    $(document).on('click', '.append_h', function(event) {
              event.stopPropagation();
           alert("append click");
           ROW_ID = $(this).closest(".documentRowID").attr("id");
           var ipAd= window.localStorage.getItem("IP_ADDRESS");
           if(ipAd==''||ipAd==null){
            navigator.notification.alert("Please configure IP Address.");
            return;
        }
            getDocumentValue();



         $.mobile.changePage($("#realTimeScreen"));
    });
     $(document).on('click', '.documentRowID', function(event) {
                    event.stopPropagation();


                       /* $.mobile.changePage($("#realTimeScreen"), {
                            transition: "slide",
                            reverse: false,
                            changeHash: false
                        });*/
        alert("row click")
        var ipAd= window.localStorage.getItem("IP_ADDRESS");
        if(ipAd==''||ipAd==null){
            navigator.notification.alert("Please configure IP Address.");
            return;
        }

        ROW_ID=this.id;
        getDocumentValue();
         $.mobile.changePage($("#realTimeScreen"));
        console.log(this.id)
    });


function queryDocumentSuccess(tx, result) {
    var len = result.rows.length;
    $('#folderInside_Data').empty();
    for (var i = 0; i < len; i++) {



       $('#folderInside_Data').append(
                '<li class="documentRowID" id="' + result.rows.item(i).id+ '" data-rel="popup" data-position-to="window">' + '<a href="#">' + '<img src="img/Documents.png">' + '<h2>' + result.rows.item(i).DocumentName + '</h2>' + '<p>' + result.rows.item(i).DocumentNotes + '</p>' + '<p>' + result.rows.item(i).DocumentDate + '</p>'  + 
                 '<span class="ctrl "><fieldset data-role="controlgroup" data-type="horizontal" data-mini="true" ><button class="button_design append_h">Append</button><button class="button_design connect_h">Review</button></fieldset><span>'+'</li>'
                );
    }
    $('#folderInside_Data').listview('refresh');

}

But it goes to home page..?

1 Answer 1

1

I don't understand everything what you are trying to achieve. But what I see is that in all three handlers, you are changing to the same page

$.mobile.changePage($("#realTimeScreen"));

It is also quite overcomplicated, 3 different click handlers doing same or very similar thing. In order to understand, it would be great to see HTML as well. And ideal would be to provide some jsFiddle.

Sign up to request clarification or add additional context in comments.

4 Comments

But i am doing the same thing
same bug i am facing ...CHECK MY UPDATE
Hello, 1) Doing the same thing with 3 buttons does not mean having 3 different methods, one for each of them. It shoudl be the opposite (such as one method which gets the button from event.target) 2) The bug you are refering to is a phonegap bug. If you are using phonegap, please tag the question with phonegap as well. Good news is that as per comments there, it is probably fixed so it may be enough to use nwever version. 3) To show/replicate the issue try to make the code simplier. It quite often helps you to see the problem before you post it somewhere, including here. Good luck of course

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.