Ok, the change event is not applied if no change happens... Try the 
following for the custom.js which should also improve the labels and 
logic in this case:

$.extend(PM.Query,
{
     createSearchItems: function(url) {
         $.ajax({
             url: url,
             dataType: "json",
             success: function(response){
                 var searchJson = response.searchJson;
                 var action = response.action;

                 if (action == 'searchitem') {
                     PM.Query.createSearchInput(searchJson);
                 } else {
                     delete searchJson.options[0];
                     var searchHtml = PM.Query.json2Select(searchJson, "0");
                     $('#searchoptions').html(searchHtml);
                     PM.Query.setSearchInput();
                     $('#searchoptions').html(_p("Search 
for")).css({"white-space": "nowrap"});
                 }
             },
             error: function (XMLHttpRequest, textStatus, errorThrown) {
                 if (window.console) console.log(errorThrown);
             }
         });
     }

});


On 07/23/2014 08:58 AM, Bogumił Szady wrote:
> Hello,
> Thanks. I have tried to insert this modification.
> I see my layer defined, but without white box on the right to put the
> search attribute.
> Where is the the problem?
>
> best
>
> Bogumił
>
>
> W dniu 2014-07-22 23:11, Armin Burger pisze:
>> not a very elegant solution, but should work:
>>
>> add the following block at the end of your
>>       /config/[your-config]/custom.js
>> file
>>
>> $.extend(PM.Query,
>> {
>>        createSearchItems: function(url) {
>>            $.ajax({
>>                url: url,
>>                dataType: "json",
>>                success: function(response){
>>                    var searchJson = response.searchJson;
>>                    var action = response.action;
>>
>>                    //---------------------------
>>                    delete searchJson.options[0];
>>                    //---------------------------
>>
>>                    if (action == 'searchitem') {
>>                        PM.Query.createSearchInput(searchJson);
>>                    } else {
>>                        var searchHtml = PM.Query.json2Select(searchJson, 
>> "0");
>>                        $('#searchoptions').html(searchHtml);
>>                    }
>>                },
>>                error: function (XMLHttpRequest, textStatus, errorThrown) {
>>                    if (window.console) console.log(errorThrown);
>>                }
>>            });
>>        }
>>
>> });
>>
>>
>>
>>
>> or use
>>
>>                    //---------------------------
>>                    if (Object.keys(searchJson.options).length < 3) {
>>                        delete searchJson.options[0];
>>                    }
>>                    //---------------------------
>>
>> to do this just in case the search has just 1 layer defined for search,
>> in case you once will add another one you don't remember what you once
>> modified...
>>
>>
>> On 07/22/2014 07:25 PM, Bogumił Szady wrote:
>>> Hello,
>>> Is it possible to get one default search field turned on in the moment
>>> of starting of application window?
>>> I have only one layer to search and I would like to avoid every time
>>> selecting layer to search.
>>>
>>>
>>> all the best
>>>
>>> Bogumił
>>>
>>> ------------------------------------------------------------------------------
>>> Want fast and easy access to all the code in your enterprise? Index and
>>> search up to 200,000 lines of code with a free copy of Black Duck
>>> Code Sight - the same software that powers the world's largest code
>>> search on Ohloh, the Black Duck Open Hub! Try it now.
>>> http://p.sf.net/sfu/bds
>>> _______________________________________________
>>> pmapper-users mailing list
>>> pmapper-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/pmapper-users
>>>
>> ------------------------------------------------------------------------------
>> Want fast and easy access to all the code in your enterprise? Index and
>> search up to 200,000 lines of code with a free copy of Black Duck
>> Code Sight - the same software that powers the world's largest code
>> search on Ohloh, the Black Duck Open Hub! Try it now.
>> http://p.sf.net/sfu/bds
>> _______________________________________________
>> pmapper-users mailing list
>> pmapper-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/pmapper-users
>
> ------------------------------------------------------------------------------
> Want fast and easy access to all the code in your enterprise? Index and
> search up to 200,000 lines of code with a free copy of Black Duck
> Code Sight - the same software that powers the world's largest code
> search on Ohloh, the Black Duck Open Hub! Try it now.
> http://p.sf.net/sfu/bds
> _______________________________________________
> pmapper-users mailing list
> pmapper-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pmapper-users
>

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
pmapper-users mailing list
pmapper-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pmapper-users

Reply via email to