Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

new errors, that I didnt have earlier

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.

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

new errors, that I didnt have earlier

Cheers Igor,
perfect answer, all sorted,

thx for your help

Anil Sagar
Posts: 0
Joined: Fri Jul 04, 2014 1:13 pm

new errors, that I didnt have earlier

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

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

new errors, that I didnt have earlier

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.

Anil Sagar
Posts: 0
Joined: Fri Jul 04, 2014 1:13 pm

new errors, that I didnt have earlier

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

Anil Sagar
Posts: 0
Joined: Fri Jul 04, 2014 1:13 pm

new errors, that I didnt have earlier

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

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

new errors, that I didnt have earlier

Hi Anil,

It should work.

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

Thanks & regards.

Anil Sagar
Posts: 0
Joined: Fri Jul 04, 2014 1:13 pm

new errors, that I didnt have earlier

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.

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

new errors, that I didnt have earlier

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.

Anil Sagar
Posts: 0
Joined: Fri Jul 04, 2014 1:13 pm

new errors, that I didnt have earlier

Many thanks Yurii. This worked.

Return to “Issues”