这是我的代码,其中包含引导表table-responsive
,其中数据由ajax填充。这里的日期排序为字符串而非日期,请帮我按dd/MM/yyyy
格式对日期进行排序:
<table class="table table-bordered table-responsive" data-pagination="true" data-search="true" id="usageTable">
<tr>
<th data-field="servicealias" data-sortable="true"><spring:message code ="label.service" /></th>
<th data-field="callStartDate" data-sortable="true"><spring:message code ="label.callstart" /></th>
<th data-field="callEndDate" data-sortable="true"><spring:message code ="label.callend" /></th>
<th data-field="sessiontime" data-sortable="true"><spring:message code ="label.sessiontime" /></th>
</tr>
</table>
答案 0 :(得分:0)
检查您是否在参考中包含了当前版本的jquery。
class AssetSerializer(serializers.ModelSerializer):
class Meta:
model = Asset
fields = '__all__'
class PortfolioElementSerializer(serializers.ModelSerializer):
asset = AssetSerializer()
class Meta:
model = PortfolioElement
fields = ('nominal', 'weight', 'asset')
class PortfolioSerializer(serializers.ModelSerializer):
elements = PortfolioElementSerializer(many=True)
class Meta:
model = Portfolio
fields = ('number', 'update_date', 'elements')
class ClientSerializer(serializers.ModelSerializer):
portfolios = PortfolioSerializer(many=True)
class Meta:
model = Client
fields = ('number', 'portfolios')
您也可以使用以下示例使用javascript进行排序