Odoo 中文社区

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • Popular
    • Users
    • Groups

    Odoo中文社区可以通过以下两个域名访问:shine-it.net , odoo.net.cn

    由于系统升迁的原因,本论坛部分较早期的内容存在格式和链接损坏失效的问题,并非本论坛系统本身的缺陷,望谅解

    本社区没有维护任何QQ群讨论组,任何与本社区同名的QQ群讨论组的言论与本社区无关!

    开发人员可以登录gitter讨论组: http://gitter.im/odoo-china/Talk, 需要github账号

    如果您登录系统碰到问题,请在微信公众号留言:

    如何实现列表上 点击排序后先按逆序排列,再点一次按正序排列

    Odoo 开发与实施交流
    6
    10
    4372
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • wjfonhand
      wjfonhand last edited by

      客户不想点两次

      GoodERP -- Odoo China fork

      1 Reply Last reply Reply Quote 0
      • Joshua
        Joshua 管理员 last edited by

        没看懂问题,你是想默认就按照正序排列还是默认按照逆序排列,还是字段a逆序,字段b正序?

        【上海先安科技】(joshua AT openerp.cn),欢迎关注公众号:openerp_cn

        1 Reply Last reply Reply Quote 0
        • wjfonhand
          wjfonhand last edited by

          就是普通的排序功能

          针对同一个日期字段排序

          现在是点一下升序,再点一下才降序。

          客户想要第一下点是降序排列,第二下点才升序排列

          GoodERP -- Odoo China fork

          1 Reply Last reply Reply Quote 0
          • 周
            周士超 last edited by

            这个还是比较重要的,我要看最新记录,还要点两下,是有点不人性化

            1 Reply Last reply Reply Quote 0
            • mrshelly
              mrshelly last edited by

              没有用, 原生就不支持到.. 非要人去点的...
              因为 排序 好象是在 web client 层面上玩的...

              看 http 请求中的参数...

              向官网提应该OK...

              1 Reply Last reply Reply Quote 0
              • 周
                周士超 last edited by

                直接改oe的js吧,在js里拼接的sql排序 ASC和DESC

                1 Reply Last reply Reply Quote 0
                • KevinKong
                  KevinKong last edited by

                  重写serialize_sort方法即可

                  <br />openerp.web.serialize_sort = function (criterion) {<br />&nbsp; &nbsp; return _.map(criterion,<br />&nbsp; &nbsp; &nbsp; &nbsp; function (criteria) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (criteria[0] === &#039;-&#039;) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return criteria.slice(1) + &#039; ASC&#039;;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return criteria + &#039; DESC&#039;;<br />&nbsp; &nbsp; &nbsp; &nbsp; }).join(&#039;, &#039;);<br />};<br />
                  
                  1 Reply Last reply Reply Quote 0
                  • 周
                    周士超 last edited by

                    [quote author=KevinKong link=topic=17418.msg31515#msg31515 date=1448418906]
                    重写serialize_sort方法即可

                    <br />openerp.web.serialize_sort = function (criterion) {<br />&nbsp; &nbsp; return _.map(criterion,<br />&nbsp; &nbsp; &nbsp; &nbsp; function (criteria) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (criteria[0] === &#039;-&#039;) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return criteria.slice(1) + &#039; ASC&#039;;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return criteria + &#039; DESC&#039;;<br />&nbsp; &nbsp; &nbsp; &nbsp; }).join(&#039;, &#039;);<br />};<br />
                    


                    [/quote]
                    重写之后,有没有看看列上的上下箭头能不能对应上,见附件,还没学会上图

                    1 Reply Last reply Reply Quote 0
                    • L
                      larjia last edited by

                      用_order字段不可以?

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post