亚州av一区二区_1区在线_国产精品久久久久久久_亚洲国产视频一区_在线观看免费av网_精品少妇一区二区三区在线播放

產品中心 業內新聞 案例中心 視頻中心

lua 對回車(%3Cbr%3E)處理方法 lua 對回車(%3Cbr%3E)處理方法

lua 對回車(%3Cbr%3E)處理方法

分類:二次開發 產品中心 低代碼 492

我們在Gird列出數據的時候,若數據內帶%3Cbr%3E,其實是回車的意思,若grid讀出數據不做任何處理,那么就會影響系統表達

為了解決這個問題,我們可以編輯一個lua腳本,將這個數據做處理后再顯示(在顯示前事件里面定義這個lua腳本)

腳本列子

–[[
? ? 功能說明:
? ? ? ? 1) 顯示前做一些字段的處理
? ? ? ? 2)前端導入,新增有換行符號 %%3Cbr%%3E  ,替換成 <br> 前端html支持的換行內容
? ? ? ? 3)內容中有&,替換成 & 前端解析 &不支持,最好在輸入時進行替換
–]]
json = require(“json”)
mobox = require(“OILua_JavelinExt”)
require(“oi_basestrfunc”)
function BeforeGridShow(strLuaDEID)
? ? local nRet, strRetInfo
? ? local arobjs, attrs, success
? ? — 獲取輸入的DataJson數據包
? ? nRet, strRetInfo = mobox.getCurEditDataPacket(strLuaDEID)
? ? if (nRet ~= 0) then
? ? ? ? mobox.error(strLuaDEID, “無法獲取數據包!”)
? ? ? ? return
? ? end
? ? if (strRetInfo == ” or strRetInfo == nil) then
? ? ? ? return
? ? end
? ? — 解析數據包,數據包格式
? ? — [{“id”:””,”attrs”:[{“attr”:””,”value”:””},..]},..]
? ? local n, nCount
? ? success, arobjs = pcall(json.decode, strRetInfo)
? ? if (success == false) then
? ? ? ? mobox.error(strLuaDEID, “非法的JSON格式!”)
? ? ? ? return
? ? end
? ? nCount = #arobjs
? ? if (nCount == 0) then
? ? ? ? return
? ? end
? ? local obj, attrs
? ? local nattr_count
? ? local strRow, strAttr, strItem
? ? local strDataJson
? ? local id, strValue
? ? local strAttrs
? ? strDataJson = ‘[‘
? ? local seg = {}
? ? local nSegCount = 0
? ? for n = 1, nCount do
? ? ? ? obj = arobjs[n]
? ? ? ? attrs = obj.attrs
? ? ? ? nattr_count = #attrs
? ? ? ? id = obj.id
? ? ? ? strAttrs=”
? ? ? ? — 開始過濾顯示數據對象屬性
? ? ? ? for nIndex = 1, nattr_count do
? ? ? ? ? ? strAttr = attrs[nIndex].attr
? ? ? ? ? ? strValue = attrs[nIndex].value
? ? ? ? ? ? strValue = strValue:gsub(“%%3Cbr%%3E”, “<br>”)
? ? ? ? ? ? strValue = strValue:gsub(“&”, “&”)
? ? ? ? ? ? strItem = ‘{“attr”:”‘ .. strAttr .. ‘”,”value”:”‘ .. strValue .. ‘”},’
? ? ? ? ? ? strAttrs = strAttrs .. strItem
? ? ? ? end
? ? ? ? — 取消最后一個,號
? ? ? ? strAttrs = trim_laster_char(strAttrs)
? ? ? ? strRow = ‘{“id”:”‘ .. id .. ‘”,”attrs”:[‘ .. strAttrs .. ‘]},’
? ? ? ? strDataJson = strDataJson .. strRow
? ? end
? ? — 取消最后一個,號
? ? strDataJson = trim_laster_char(strDataJson)
? ? strDataJson = strDataJson .. ‘]’
? ? local strAction = ‘[{“action_type”:”reset_data_attr”,”value”:’ .. strDataJson .. ‘}]’
? ? mobox.setAction(strLuaDEID, strAction)
end
這個列子也可以用于別的一些非法字符串的處理
標簽:低代碼腳本 上一篇: 下一篇:
展開更多
預約軟件體驗

loading...

主站蜘蛛池模板: 国产福利91精品一区二区三区 | 久久精品国产一区二区电影 | 麻豆视频在线免费看 | 久草电影网 | 国产a区| 91久久精 | 久久精品免费一区二区三 | 亚洲国产成人精品女人久久久 | 国产成人午夜高潮毛片 | 毛片一级片 | 黑人巨大精品 | 伊人网在线综合 | 免费一二区 | 亚洲日本成人 | 久久在线| 拍真实国产伦偷精品 | 国产精品一区在线观看 | 日韩av成人在线 | 免费久久99精品国产婷婷六月 | 91视频进入 | 国产精品乱码一区二三区小蝌蚪 | 亚洲一区国产精品 | 国产婷婷在线视频 | 欧美在线视频一区 | 性色视频 | 亚洲视频手机在线 | 久久久精彩视频 | 一级免费看 | 99re国产视频 | 18性欧美| 欧美综合久久 | 日韩欧美天堂 | 一级黄色夫妻生活 | 中文字幕一区二区三区不卡 | 亚洲第一成人影院 | 久久久久国产精品午夜一区 | 人人爽日日躁夜夜躁尤物 | 午夜av电影 | 四虎海外| 一级高清免费毛片 | 中文字幕 国产精品 |