Page 3 of 3

new errors, that I didnt have earlier

Posted: Wed Apr 23, 2014 10:31 pm
by Michael4771079

thank you all, now sorted,
but very worrying,
if you guys update the platform,
and a published app uses appery.io services,
it may be f***** for 2 weeks or more
very worrying.

We are never in a position to predict an update prob, or the possible cost to the project.

We are not told of important info that affects the js and the logic of an app, like tags

I would love if appery.io could be the only platform worth considering for hybrid apps,
like ps is for graphics

but the problem will always be if the platform decides it needs to go in a different direction than previously stated, your investment and time is wasted

AC for eg.


new errors, that I didnt have earlier

Posted: Wed Apr 23, 2014 10:34 pm
by Michael4771079

Cheers Igor,
perfect answer, all sorted,

thx for your help


new errors, that I didnt have earlier

Posted: Wed Jul 30, 2014 6:54 pm
by Anil Sagar

Hi, I am trying to use the following code to delete a record from an "Offer" array if a 'buy' button is clicked. There seems to be some problem with how I get the index. It shows value "NaN" and hence nothing happens to the array. All records remain intact in the array. What am I doing wrong?

Code: Select all

     var mainorderArray; 

try {
mainorderArray = JSON.parse(localStorage.getItem("Offers_LS"));

Code: Select all

 if ({}.toString.call(mainorderArray) !== "[object Array]") { 
 mainorderArray = []; 
 } 

} catch ( e ) {
mainorderArray = [];
}
var $this = $(this);

console.log($this);
console.log($this.attr("dsid"));
if($this.attr("dsid").slice(1)) {

Code: Select all

 var rootItemElement = $this.closest('[name="mobilegrid_1"]'); 

var index = parseInt(rootItemElement.attr("dsid").slice(1));

Code: Select all

 alert(index); 

 if (index =0 && index < mainorderArray.length) { 
     mainorderArray.splice(index, 1); 
 } 

}

Code: Select all

 localStorage.setItem("Offers_LS", JSON.stringify(mainorderArray)); 

 alert(JSON.stringify(mainorderArray)); 

The "Buy" button is placed in a grid (mobilegrid_1) as shown below
Image


new errors, that I didnt have earlier

Posted: Thu Jul 31, 2014 3:46 am
by Yurii Orishchuk

Hi Anil,

Please use following code to get clicked item order.

pre

var $this = jQuery(this);

&#47;&#47;Note you need replace "mobilegrid_2" with your grid component name&#46;
var rootItemElement = $this&#46;closest('[name="mobilegrid_2"]');
var index = parseInt(rootItemElement&#46;attr("_idx")&#46;slice(1));

alert(index);

/pre

See details: http://prntscr.com/481qin/direct

Regards.


new errors, that I didnt have earlier

Posted: Thu Jul 31, 2014 4:07 am
by Anil Sagar

Hi Yurii,

As per your suggestion I have replaced in my code 2 things:

  1. var $this = $(this);
    with
    var $this = jQuery(this);

  2. dsid with _idx

    index is still shown as undefined in the alert


new errors, that I didnt have earlier

Posted: Thu Jul 31, 2014 3:51 pm
by Anil Sagar

Can somebody help with this pls? What could be the problem?

The following code alerting undefined:

var $this = jQuery(this);
alert($this.attr("_idx"));

Given below is my 'buy' button placement in 'offer_grid' (which has replaced mobilegrid_2) in the code given by Yurii above.

I think there is some problem in using 'this'.

Image


new errors, that I didnt have earlier

Posted: Thu Jul 31, 2014 9:46 pm
by Yurii Orishchuk

Hi Anil,

It should work.

Please give us your app public link and describe steps to reproduce this problem.

Thanks & regards.


new errors, that I didnt have earlier

Posted: Thu Jul 31, 2014 11:39 pm
by Anil Sagar

Hi Yurii, pls see my app here...

http://appery.io/app/view/177c5783-d9...

Steps to reproduce are:

  1. When the first page loads, click anywhere on the 3 offers just below the heading of "My Offers"

  2. This will take you to page 2 where you will see details of all offers

  3. Click on any of the "Buy" buttons. It will throw an "undefined" alert and show the error in console as well.

    If any error comes before loading page 2, it's because of FB share buttons. That also needs to be resolved separately but that error does not come all the time. If you refresh, the error will go away and page 2 will load fine and then you can follow through step 3.


new errors, that I didnt have earlier

Posted: Fri Aug 01, 2014 2:16 am
by Yurii Orishchuk

Anil,

If i understand you correctly i test "Offers_Prepaid.html" page. Here is mistake in your implementation:

You need to replace part of your code:

pre

var $this = jQuery(this);
alert($this&#46;attr("_idx"));

console&#46;log($this);
console&#46;log($this&#46;attr("_idx"));

if($this&#46;attr("_idx")&#46;slice(1)) {

Code: Select all

 var rootItemElement = $this&#46;closest('[name="offer_grid"]'); 

var index = parseInt(rootItemElement&#46;attr("_idx")&#46;slice(1));

Code: Select all

 alert(index); 

 if (index =0 && index < mainorderArray&#46;length) { 
     mainorderArray&#46;splice(index, 1); 
 } 

}

/pre

With following:

pre

var $this = jQuery(this);
&#47;&#47;alert($this&#46;attr("_idx"));

&#47;&#47;console&#46;log($this);
&#47;&#47;console&#46;log($this&#46;attr("_idx"));

&#47;&#47;if($this&#46;attr("_idx")&#46;slice(1)) {

Code: Select all

 var rootItemElement = $this&#46;closest('[name="offer_grid"]'); 

var index = parseInt(rootItemElement&#46;attr("_idx")&#46;slice(1));

Code: Select all

 alert(index); 

 if (index =0 && index < mainorderArray&#46;length) { 
     mainorderArray&#46;splice(index, 1); 
 } 

&#47;&#47;}

/pre

Regards.


new errors, that I didnt have earlier

Posted: Fri Aug 01, 2014 7:01 pm
by Anil Sagar

Many thanks Yurii. This worked.