Closed michaelsogos closed 10 years ago
Hi,
I don't really understand, can you show me a OData api
example?
Sure,
An OData is an API manifest to standardize the communication between client and server (consumer and data-service) in a RESTFul service. It define how a service have to be called and how the response have to be.
This is the official page to take a look: http://docs.oasis-open.org/odata/odata/v4.0/os/part2-url-conventions/odata-v4.0-os-part2-url-conventions.html#_Toc372793791 Here are some example: http://www.odata.org/documentation/odata-version-3-0/url-conventions/ Here too: http://wiki.sensenet.com/index.php?title=OData_REST_API
However in every example you can see is not important the url itself but the QUERY PARAMETERS. Every query parameter have to starts with ‘$’ (Ex. $select, $filter) and every parameter have its convention about the value that can be passed.
From: 文翼 Sent: Monday, August 18, 2014 4:16 PM To: wenzhixin/bootstrap-table Cc: Michael Sogos Subject: Re: [bootstrap-table] OData (#72)
Hi,
I don't really understand, can you show me a OData api example?
— Reply to this email directly or view it on GitHub.
Hi,
now the queryParams
object option contains:
pageSize, pageNumber, searchText, sortName and sortOrder.
If you want to have a default set of parameter, I think you can do like this:
bootstrap-table-defaults.js
: (function ($) {
'use strict';
$.extend($.fn.bootstrapTable.defaults, {
search: true,
pagination: true,
sidePagination: 'server',
showColumns: true,
queryParams: function (params) {
// modify the code you need here
return {
limit: params.pageSize,
offset: params.pageSize * (params.pageNumber - 1),
search: params.searchText,
sort: params.sortName,
order: params.sortOrder
};
}
});
})(jQuery);
<script src="bootstrap-table.js"></script>
<script src="bootstrap-table-defaults.js"></script>
Hope to help you.
Best, zhixin
Hi,
Thank you so much, i already did it in my way.
From: 文翼 Sent: Monday, August 18, 2014 6:07 PM To: wenzhixin/bootstrap-table Cc: Michael Sogos Subject: Re: [bootstrap-table] OData (#72)
Hi,
now the queryParams object option contains: pageSize, pageNumber, searchText, sortName and sortOrder.
If you want to have a default set of parameter, I think you can do like this:
a.. Create a default set file: bootstrap-table-defaults.js: (function ($) { 'use strict';
$.extend($.fn.bootstrapTable.defaults, {
search: true,
pagination: true,
sidePagination: 'server',
showColumns: true,
queryParams: function (params) {
// modify the code you need here
return {
limit: params.pageSize,
offset: params.pageSize * (params.pageNumber - 1),
search: params.searchText,
sort: params.sortName,
order: params.sortOrder
};
}
});
})(jQuery); a.. Include the files:
Hope to help you.
Best, zhixin
— Reply to this email directly or view it on GitHub.
you're welcome:)
Hi,
Great plugin, really!
I question, can you give us the support for OData? I mean the queryParams could have a default set of parameter already compatible for OData api?