agea / Alfresco-HTML5-Client

Pure HTML5 and Javascript Alfresco client
MIT License
25 stars 10 forks source link

Changing cmis query from 'select * from cmis:documents' to 'select d.* from cmis:documents as d' breaks parsing #13

Open ghost opened 11 years ago

ghost commented 11 years ago

Hi not sure if this is in scope or not - but if change the cmis query from

select * from cmis:documents

to something like

select d.* from cmis:documents as d

the knockout parsing seems to break on the results. For example:

[Error] Error: Unable to parse bindings. Message: TypeError: 'undefined' is not an object (evaluating '$data.properties['cmis:name'].value'); Bindings value: text: $data.properties['cmis:name'].value

I have been checking this out to query aspects (with a correctly formed Alfresco CMIS query) and while the right number of results are returned (I can check results.numItems), something is choking when I try to iterate through the results using the standard search result templates you have in the project

I have done a direct CMIS query to be returned via XML, and the resultant XML string only differs in a timestamp and the actual query string - I can provide an example if you wish - I don't seem to be able to attach text files to this issue

screen shot 20131003001

This screen shot is for a search around cmis:folders - but it occurs for cmis:documents as well

ghost commented 11 years ago

The issue is with the search results template - need a way to figure out the alias and build into the template - in my above example, where r is the alias

    <div><span data-bind="text: $data.properties['cmis:name'].value"></span>

would have to become

    <div><span data-bind="text: $data.properties['cmis:name'].value"></span>

testing with that modification to the template works as expected.

agea commented 11 years ago

a way to make it work by not changing the template is to make the query like this:

"select D.cmis:objectId as cmis:objectId, D.cmis:name as cmis:name,..."

ghost commented 11 years ago

Oh man, I didn't think of that. Sorry. Thought I was on to something :)