cq-panda / Vue.NetCore

(已支持sqlsugar).NetCore、.Net6、Vue2、Vue3、Vite、TypeScript、Element plus+uniapp前后端分离,全自动生成代码;支持移动端(ios/android/h5/微信小程序。http://www.volcore.xyz/
MIT License
3.83k stars 1.27k forks source link

子档的排序如何设定?? #253

Open Jay413191 opened 2 years ago

Jay413191 commented 2 years ago

请教一下,如图,子档的排序如何设定?? 有试着如下写在loadBefore,但是程序不会调用里?

loadBefore(param, callBack) {       param.sort = "SNo";       param.order = "ASC";       callBack(true);     },

image

cq-panda commented 2 years ago

试试这个onInited(){ this.detailOptions.pagination.sortName = "排序字字段"; this.detailOptions.pagination.order = "desc" ; }

Jay413191 commented 2 years ago

如下图 image

但结果没有改变 image

Jay413191 commented 2 years ago

补充一下, 没有this.detailOptions.pagination.order image

Jay413191 commented 2 years ago

看了文档这样做,但是也没作用 image

Jay413191 commented 2 years ago

也有试以下方法,在debug时看到设置是正确的,但是执行结果还是没变

public override object GetDetailPage(PageDataOptions pageData) { var query = OrdersDetailRepository.Instance.IQueryablePage( pageData.Page, pageData.Rows, out int count, x => x.OrderKey == 79, orderBy: x => new Dictionary<object, QueryOrderBy>() { { x.SNo, QueryOrderBy.Asc } } ); PageGridData detailGrid = new PageGridData(); detailGrid.rows = query.ToList(); detailGrid.total = count; return base.GetDetailPage(pageData); }

image

cq-panda commented 2 years ago

var query = OrdersDetailRepository.Instance.FindAsIQueryable(x => x.查询字段== pageData.Value).OrderByDescending(x => x.SNo)                 .TakePage(pageData.Page, pageData.Rows);

------------------ 原始邮件 ------------------ 发件人: "cq-panda/Vue.NetCore" @.>; 发送时间: 2022年7月4日(星期一) 中午12:12 @.>; @.**@.>; 主题: Re: [cq-panda/Vue.NetCore] 子档的排序如何设定?? (Issue #253)

也有试以下方法,在debug时看到设置是正确的,但是执行结果还是没变

public override object GetDetailPage(PageDataOptions pageData) { QueryablePage( pageData.Page,var query = OrdersDetailRepository.Instance.I pageData.Rows, out int count, x => x.OrderKey == 79, orderBy: x => new Dictionary<object, QueryOrderBy>() { { x.SNo, QueryOrderBy.Asc } } ); PageGridData detailGrid = new PageGridData(); detailGrid.rows = query.ToList(); detailGrid.total = count; return base.GetDetailPage(pageData); }

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

Jay413191 commented 2 years ago

有修改如大大所示,code如下,但是一样在后端debug看顺序是对的(SNo ASC),但在前端呈现出来的还是SNo DESC.

public override object GetDetailPage(PageDataOptions pageData) { var query = OrdersDetailRepository.Instance.FindAsIQueryable(x => x.OrderKey == 79).OrderBy(x => x.SNo).TakePage(pageData.Page, pageData.Rows); PageGridData detailGrid = new PageGridData(); detailGrid.rows = query.ToList(); return base.GetDetailPage(pageData); }

cq-panda commented 2 years ago

------------------ 原始邮件 ------------------ 发件人: "cq-panda/Vue.NetCore" @.>; 发送时间: 2022年7月4日(星期一) 下午3:24 @.>; @.**@.>; 主题: Re: [cq-panda/Vue.NetCore] 子档的排序如何设定?? (Issue #253)

return base.GetDetailPage(pageData);这个不要,直接 detailGrid.total=query.Count();   return detailGrid ;

有修改如大大所示,code如下,但是一样在后端debug看顺序是对的(SNo ASC),但在前端呈现出来的还是SNo DESC.

public override object GetDetailPage(PageDataOptions pageData) { var query = OrdersDetailRepository.Instance.FindAsIQueryable(x => x.OrderKey == 79).OrderBy(x => x.SNo).TakePage(pageData.Page, pageData.Rows); PageGridData detailGrid = new PageGridData(); detailGrid.rows = query.ToList(); return base.GetDetailPage(pageData); }

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

Jay413191 commented 2 years ago

太感动了, 可以了, 谢谢大大!!

public override object GetDetailPage(PageDataOptions pageData) { var query = OrdersDetailRepository.Instance.FindAsIQueryable(x => x.OrderKey == pageData.Value.GetInt()).OrderBy(x => x.SNo).TakePage(pageData.Page, pageData.Rows); PageGridData detailGrid = new PageGridData(); detailGrid.rows = query.ToList(); detailGrid.total = query.Count(); return detailGrid; }