Page 3 of 4

list empty returns javascript error

Posted: Thu Jun 13, 2013 12:58 pm
by Kateryna Grynko

Hi,

We'll think and update.


list empty returns javascript error

Posted: Thu Jun 13, 2013 8:25 pm
by Maryna Brodina

Hello! Don't save to localStorage hidden element. There is easier way. Instead of empty() delete all elements except those one you use for mapping.
1) For list instead of empty() it's better to use code:
codeAppery('list').find("li").not("[dsid=listItem]").remove();/code
where list - list's name
listItem - item name in list where you map

2) for select instead of empty() use
codeAppery("mobileselectmenu").find("option").not("[_tmpl=true]").remove();/code


list empty returns javascript error

Posted: Fri Jun 14, 2013 7:12 am
by w

It is not working, the hidden element is still removed with this find:

Appery('lstContacten').find('li').not('[dsid="mobilelistitem1_3"]').remove();

When I do a Appery('lstContacten').find('li').not('[dsid="mobilelistitem1_3"]').each(
function(){
alert($(this).prop('outerHTML'));
}

);

I get this:

precode

<li style="display: none;" data-theme="b" data-iconpos="right" data-icon="false" data-wrapperels="div" data-iconshadow="true" data-shadow="false" data-corners="false" class="mobilelistitem1 ui-btn ui-btn-up-b ui-btn-icon-right ui-li ui-li-has-alt ui-first-child ui-last-child"><div class="ui-btn-inner ui-li ui-li-has-alt"><div class="ui-btn-text">
<a id="j_69" name="mobilelistitem1_3" dsid="mobilelistitem1_3" tabindex="3" class="mobilelistitem1 ui-link-inherit">
<h3 class="ui-li-heading">Item 1<&#47;h3>
<&#47;a>
<!-- mobilelistitembtn1_4 -->

Code: Select all

                 <&#47;div><&#47;div><a data-iconpos="notext" data-icon="false" data-wrapperels="span" data-iconshadow="true" data-shadow="false" data-corners="false" title="" id="j_70" data-theme="b" name="mobilelistitembtn1_4" dsid="mobilelistitembtn1_4" class="button mobilesplitbuttonitem1  ui-li-link-alt ui-btn ui-btn-up-b ui-btn-icon-notext"><span class="ui-btn-inner"><span class="ui-btn-text"><&#47;span><span class="ui-btn ui-btn-up-b ui-shadow ui-btn-corner-all ui-btn-icon-notext" title="" data-theme="b" data-iconpos="notext" data-icon="arrow-r" data-wrapperels="span" data-iconshadow="true" data-shadow="true" data-corners="true"><span class="ui-btn-inner"><span class="ui-btn-text"><&#47;span><span class="ui-icon ui-icon-arrow-r ui-icon-shadow">&nbsp;<&#47;span><&#47;span><&#47;span><&#47;span><&#47;a><&#47;li> 

/code/pre

Am I doing something wrong here, because I suppose that this 'li' item is not supposed to be included in the find, since it contains a childelement with dsid="mobilelistitem1_3" ? And because it is wrongly included, it is still deleted with the empty().


list empty returns javascript error

Posted: Fri Jun 14, 2013 7:23 am
by Kateryna Grynko

We'll check.


list empty returns javascript error

Posted: Fri Jun 14, 2013 7:52 am
by w

For the moment I solved it with this, but if there are a lot of items, it is very inefficient because of the 2 find instructions:

precode

Appery('lstContacten')&#46;find('li')&#46;each(
function(){
var delete = true;
$(this)&#46;find('a[dsid="mobilelistitem1_3"]')&#46;each(
function(){
delete = false;
}
);
if(delete){
$(this)&#46;remove();
}
}
);

/code/pre


list empty returns javascript error

Posted: Fri Jun 14, 2013 8:34 pm
by Maryna Brodina

Hello! Could you give us your public app link so we can test it, because we can't reproduce the problem.


list empty returns javascript error

Posted: Fri Jun 14, 2013 8:54 pm
by Maryna Brodina

Code generation on Appery.io and Progress.com is different, but in general you've found good solution, but your function is a little bit complicated. It's better to use:
codeAppery('list')&#46;find("li")&#46;filter(function(){return $(this)&#46;find('[dsid=listItem]')&#46;size() == 0})&#46;remove();/code


list empty returns javascript error

Posted: Mon Jun 17, 2013 8:51 am
by w

Ok, thank you!


list empty returns javascript error

Posted: Mon Oct 21, 2013 5:37 am
by Kirit Vaghela

Hello,

I just add service into source page. The datasources empty before I add this service. Now the datasources has one service but when I execute the service I'm getting codeTypeError: context is undefined

elem = context&#46;find("[dsid='" + name + "'], " +/code Image error

Is their any extra step required to add first service to page?

I also print the context value and it's getting undefined.

Thanks


list empty returns javascript error

Posted: Mon Oct 21, 2013 6:27 am
by Kirit Vaghela

Solved : I have just copy whole service from another page so I'm getting error in response mapping.