Really Thanks! It is so easy!

2009/9/11 <alexbodn.gro...@gmail.com>

> jQuery('#x').autocomplete(.....,parse=function(data){parse the data with
> same resulting format as parse(data) in autocomplete}, ...);
>
>
> On Fri, Sep 11, 2009 at 23:37, Joao Gilberto Magalhaes <
> joaogilbertomagalh...@gmail.com> wrote:
>
>> Hi Alex,
>>
>> Thanks for your quick response. There is one item about parse XML in the
>> autocomplete TODO document, so my intention is help the project.
>>
>> But, in fact I prefer use a solution with no change in autocomplete. Could
>> you give a rough sample about HOW I implement this?
>>
>> Thank you again.
>>
>> 2009/9/11 <alexbodn.gro...@gmail.com>
>>
>>>
>>> hi,
>>>
>>> i'm personally not the maintainer of autocomplete, but in my opinion this
>>> code is too purpose specific to be hardwired in autocomplete.
>>>
>>> but you could pass a function with the part in else as the 'parse'
>>> argument to autocomplete, and need no change in autocomplete itself.
>>>
>>> On Fri, Sep 11, 2009 at 18:32, Joao Gilberto Magalhaes
>>> <joaogilbertomagalh...@gmail.com> wrote:
>>>
>>>>
>>>> Hi,
>>>>
>>>> Basically to work like I said before I make the follow changes in
>>>> AutoComplete v1.1 (full file is attached)
>>>>
>>>> function parse(data) {
>>>>     var parsed = [];
>>>>     if (!options.xmlResult)
>>>>     {
>>>>         var rows = data.split("\n");
>>>>         for (var i=0; i < rows.length; i++) {
>>>>             var row = $.trim(rows[i]);
>>>>             if (row) {
>>>>                 row = row.split("|");
>>>>                 parsed[parsed.length] = {
>>>>                     data: row,
>>>>                     value: row[0],
>>>>                     result: options.formatResult &&
>>>> options.formatResult(row, row[0]) || row[0]
>>>>                 };
>>>>             }
>>>>         }
>>>>     }
>>>>     else
>>>>     {
>>>>         var count = 0;
>>>>         $(data).find(options.xmlResult).each(function() {
>>>>             var aux = [];
>>>>             aux[0] = $(this).html();
>>>>             for(i=0;i<options.xmlAttrNodes.length;i++)
>>>>             {
>>>>                 aux[i+1] = $(this).attr(options.xmlAttrNodes[i]);
>>>>             }
>>>>             parsed[count++] = {
>>>>                 data: aux,
>>>>                 value: aux[0],
>>>>                 result: options.formatResult &&
>>>> options.formatResult(aux,
>>>> aux[0]) || aux[0]
>>>>             };
>>>>         });
>>>>     }
>>>>     return parsed;
>>>> };
>>>>
>>>> and did this inside the $.Autocompleter.defaults declaration
>>>>
>>>>     xmlResult: false,
>>>>     xmlAttrNodes: ["id", "value"],
>>>>
>>>>
>>>> So, Is this code OK to be incorporated to future releases of the
>>>> Autocomplete plugin?
>>>>
>>>> Thanks in advanced.
>>>>
>>>>
>>>> 2009/9/10 <alexbodn.gro...@gmail.com>
>>>>
>>>>>
>>>>> play with the options to autocomplete: dataType, parse are handling the
>>>>> conversation with the server.
>>>>>
>>>>> On Wed, Sep 9, 2009 at 16:11, Joao Gilberto
>>>>> <joaogilbertomagalh...@gmail.com> wrote:
>>>>>
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> First of all, I want to thank you about your excellent Autocomplete
>>>>>> plugin for jQuery.
>>>>>>
>>>>>> So, I plan use your component in my open source framework called
>>>>>> XMLNuke. This framework produces XML, so I made some changes in jQuery
>>>>>> Autocomplement plugin to support receive XML data.
>>>>>>
>>>>>> Here an Example:
>>>>>>
>>>>>>    $("#teste3").autocomplete("demo/search.php", {
>>>>>>        width: 260,
>>>>>>        selectFirst: false,
>>>>>>        xmlResult: "value",
>>>>>>        xmlAttrNodes: [ "id", "info" ]
>>>>>>    });
>>>>>>
>>>>>> The XML looks like to:
>>>>>>
>>>>>> <rootnode>
>>>>>>   <value id="1" info="Some Info 1">Some Description 1</value>
>>>>>>   <value id="2" info="Some Info 2">Some Description 2</value>
>>>>>>   <value id="3" info="Some Info 3">Some Description 3</value>
>>>>>> </rootnode>
>>>>>>
>>>>>> How do I attach the file with the changes in Plugin?
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> alex
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> alex
>>>
>>>
>>
>>
>
>
> --
> alex
>
>

Reply via email to