• Ext:前台js往gridpanel动态添加记录


    stor:

    <ext:Store ID="StorePutInImg" runat="server">
            <Reader>
                <ext:JsonReader IDProperty="PicName">
                    <Fields>
                        <ext:RecordField Name="PicName">
                        </ext:RecordField>
                        <ext:RecordField Name="PicFileName">
                        </ext:RecordField>
                        <ext:RecordField Name="CreateTime">
                        </ext:RecordField>
                        <ext:RecordField Name="PicMark">
                        </ext:RecordField>
                    </Fields>
                </ext:JsonReader>
            </Reader>
        </ext:Store>

    js:

     var picToTempGridPanel = function () {
                  var store = new Ext.data.ArrayStore({
                      autoDestroy: true,
                      fields: [{
                          name: 'PicName'
                      },
                    {
                        name: 'PicFileName'
                    },
                    {
                        name: 'CreateTime'
                    },
                    {
                        name: 'PicMark'
                    }]
                  });
                  var defaultData = {
                      PicName: txtpocName.getValue(),
                      //PicFileName: picFilePath.getValue(),
    
                      CreateTime: '20121010',
                      PicMark: txImgMark.getValue()
                  };
                  //alert(Ext.encode(defaultData));
                  StorePutInImg.loadData(defaultData, true); //原型loadData( data, [append] )追加方式
                 
              }

    stor中最主要的一行:

    <ext:JsonReader IDProperty="PicName">
    这个字段必须要在添加的记录行里面赋值,不然添加记录会失败!

    另外,设置了IDProperty="PicName",Ext会根据PicName来判断记录是不是相同,相同的话则不会往stor里面添加。
  • 相关阅读:
    WebView用法与JS交互(2) 响应webview中的图片点击事件
    出栈序列(栈和队列)
    Log Files
    Mr. Frog’s Game
    Comparison of Android versions
    Linearization of the kernel functions in SVM
    Game of Nuts
    Easy Summation
    Automatic Judge
    Coprime Sequence
  • 原文地址:https://www.cnblogs.com/jinianjun/p/2749695.html
Copyright © 2020-2023  润新知